From 661eeab1eb64c0260555d14dc3d5fca9b3acb2d0 Mon Sep 17 00:00:00 2001 From: mtadel Date: Tue, 14 Nov 2006 16:27:46 +0000 Subject: [PATCH] From Ludovic: new files for visualization of V0s. --- EVE/Reve/V0.cxx | 1078 ++++++++++++++++++++++++++++++++++++++++ EVE/Reve/V0.h | 428 ++++++++++++++++ EVE/Reve/V0Editors.cxx | 558 +++++++++++++++++++++ EVE/Reve/V0Editors.h | 102 ++++ 4 files changed, 2166 insertions(+) create mode 100644 EVE/Reve/V0.cxx create mode 100644 EVE/Reve/V0.h create mode 100644 EVE/Reve/V0Editors.cxx create mode 100644 EVE/Reve/V0Editors.h diff --git a/EVE/Reve/V0.cxx b/EVE/Reve/V0.cxx new file mode 100644 index 00000000000..ec89c0b18c7 --- /dev/null +++ b/EVE/Reve/V0.cxx @@ -0,0 +1,1078 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + + +/*********************************************************************** +* This code defines the reconstructed v0 visualized with EVE +* +* Ludovic Gaudichet (gaudichet@to.infn.it) +************************************************************************/ + +#include "Track.h" +#include "V0.h" +#include "MCHelixLine.hi" + +#include +#include +#include + +#include +#include +#include +#include + +#include + +using namespace Reve; + + + +/*********************************************************************** +* +* V0 class +* +************************************************************************/ + +const Float_t V0::fgkMassPion2 = 0.13956995*0.13956995; +const Float_t V0::fgkMassProton2 = 0.93827231*0.93827231; + +ClassImp(Reve::V0) + +V0::V0() : + RenderElement(), + TPolyMarker3D(1), + fV_neg(), + fP_neg(), + fV_pos(), + fP_pos(), + fV_v0(), + fV0_birth(), + fBeta_neg(0), + fBeta_pos(0), + fLabel_neg(0), + fLabel_pos(0), + fPathMarksNeg(), + fPathMarksPos(), + fRnrStyle(0), + fPolyLineNeg(), + fPolyLinePos(), + fPolyLineV0(), + fESDIndex(-1), + fDaughterDCA(999), + fCosPointingAngle(999), + fDecayLength(0) +{} + + +V0::V0(Reve::RecTrack* tNeg, Reve::RecTrack* tPos, + Reve::RecV0* v0, TrackRnrStyle* rs) : + RenderElement(), + TPolyMarker3D(1), + fV_neg(v0->V_neg), + fP_neg(v0->P_neg ), + fV_pos(v0->V_pos ), + fP_pos(v0->P_pos), + fV_v0(v0->V_ca), + fV0_birth(v0->V0_birth), + fBeta_neg(tNeg->beta), + fBeta_pos(tPos->beta), + fLabel_neg(v0->d_label[0]), + fLabel_pos(v0->d_label[1]), + fPathMarksNeg(), + fPathMarksPos(), + fRnrStyle(rs), + fPolyLineNeg(), + fPolyLinePos(), + fPolyLineV0(), + fESDIndex(-1), + fDaughterDCA(999), + fCosPointingAngle(999), + fDecayLength(0) +{ + fMarkerColor = fRnrStyle->GetColor(); + fPolyLineV0.SetLineColor(fMarkerColor); + fPolyLinePos.SetLineColor(2); // red + fPolyLineNeg.SetLineColor(7); // light blue + + fMainColorPtr = &fMarkerColor; + fMarkerStyle = 20; + fMarkerColor = 5; + fMarkerSize = 0.3; +} + + +V0::~V0() +{ + for (vpPathMark_i i=fPathMarksNeg.begin(); i!=fPathMarksNeg.end(); ++i) + delete *i; + for (vpPathMark_i i=fPathMarksPos.begin(); i!=fPathMarksPos.end(); ++i) + delete *i; +} + + +void V0::Reset(TPolyLine3D* polyLine) { + //polyLine->SetPolyLine(n_points); + polyLine->SetPolyLine(0); +} + +//______________________________________________________________________ +void V0::SetDecayLength(Float_t primx, Float_t primy, Float_t primz) { + + Float_t dx = fV_v0.x-primx; + Float_t dy = fV_v0.y-primy; + Float_t dz = fV_v0.z-primz; + + fDecayLength = sqrt(dx*dx+dy*dy+dz*dz); + + // This is probably wrong but I can only do this for now + Float_t distNorm = fDecayLength/GetMomentum(); + fV0_birth.x = fV_v0.x - distNorm*GetPx(); + fV0_birth.y = fV_v0.y - distNorm*GetPy(); + fV0_birth.z = fV_v0.z - distNorm*GetPz(); +} + + + +//______________________________________________________________________ +void V0::MakeTrack(vpPathMark_t& pathMark, Reve::Vector& vtx, Reve::Vector& p, + Int_t charge, Float_t beta, TPolyLine3D& polyLine) { + + TrackRnrStyle& RS((fRnrStyle != 0) ? *fRnrStyle : TrackRnrStyle::fgDefStyle); + + Float_t px = p.x, py = p.y, pz = p.z; + + MCVertex mc_v0; + mc_v0.x = vtx.x; + mc_v0.y = vtx.y; + mc_v0.z = vtx.z; + mc_v0.t = 0; + + std::vector track_points; + Bool_t decay = kFALSE; + + if ((TMath::Abs(vtx.z) > RS.fMaxZ) || (vtx.x*vtx.x + vtx.y*vtx.y > RS.fMaxR*RS.fMaxR)) + goto make_polyline; + + if (TMath::Abs(RS.fMagField) > 1e-5) { + + // Charged particle in magnetic field + + Float_t a = RS.fgkB2C * RS.fMagField * charge; + + MCHelix helix(fRnrStyle, &mc_v0, TMath::C()*beta, &track_points, a); //m->cm + helix.Init(TMath::Sqrt(px*px+py*py), pz); + + if(!pathMark.empty()){ + for(std::vector::iterator i=pathMark.begin(); + i!=pathMark.end(); ++i) { + + Reve::PathMark* pm = *i; + + if(RS.fFitDaughters && pm->type == Reve::PathMark::Daughter){ + if(TMath::Abs(pm->V.z) > RS.fMaxZ + || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR ) + goto helix_bounds; + + //printf("%s fit daughter \n", fName.Data()); + helix.LoopToVertex(p.x, p.y, p.z, pm->V.x, pm->V.y, pm->V.z); + p.x -= pm->P.x; + p.y -= pm->P.y; + p.z -= pm->P.z; + } + if(RS.fFitDecay && pm->type == Reve::PathMark::Decay){ + + if(TMath::Abs(pm->V.z) > RS.fMaxZ + || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR ) + goto helix_bounds; + helix.LoopToVertex(p.x, p.y, p.z, pm->V.x, pm->V.y, pm->V.z); + decay = true; + break; + } + } + } + helix_bounds: + //go to bounds + if(!decay || RS.fFitDecay == kFALSE){ + helix.LoopToBounds(px,py,pz); + // printf("%s loop to bounds \n",fName.Data() ); + } + + } else { + + // Neutral particle or no field + + MCLine line(fRnrStyle, &mc_v0, TMath::C()*beta, &track_points); + + if(!pathMark.empty()) { + for(std::vector::iterator i=pathMark.begin(); + i!=pathMark.end(); ++i) { + Reve::PathMark* pm = *i; + + if(RS.fFitDaughters && pm->type == Reve::PathMark::Daughter){ + if(TMath::Abs(pm->V.z) > RS.fMaxZ + || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR ) + goto line_bounds; + line.GotoVertex(pm->V.x, pm->V.y, pm->V.z); + p.x -= pm->P.x; + p.y -= pm->P.y; + p.z -= pm->P.z; + } + + if(RS.fFitDecay && pm->type == Reve::PathMark::Decay){ + if(TMath::Abs(pm->V.z) > RS.fMaxZ + || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR ) + goto line_bounds; + line.GotoVertex(pm->V.x, pm->V.y, pm->V.z); + decay = true; + break; + } + } + } + + line_bounds: + if(!decay || RS.fFitDecay == kFALSE) + line.GotoBounds(px,py,pz); + + } +make_polyline: + Reset(&polyLine); + for(std::vector::iterator i=track_points.begin(); + i!=track_points.end(); ++i) { + polyLine.SetNextPoint(i->x,i->y, i->z); + } + +} + + +//______________________________________________________________________ +void V0::MakeV0path() { + + MCVertex mc_v0; + mc_v0.x = fV_v0.x; + mc_v0.y = fV_v0.y; + mc_v0.z = fV_v0.z; + mc_v0.t = 0; + + std::vector track_points; + MCLine line(fRnrStyle, &mc_v0, TMath::C()*0.99, &track_points); + + line.GotoVertex(fV0_birth.x,fV0_birth.y,fV0_birth.z); + + Reset(&fPolyLineV0); + for(std::vector::iterator i=track_points.begin(); + i!=track_points.end(); ++i) { + fPolyLineV0.SetNextPoint(i->x,i->y, i->z); + } +} + + +//______________________________________________________________________ +void V0::MakeV0() +{ + SetNextPoint(fV_v0.x, fV_v0.y, fV_v0.z); + MakeTrack(fPathMarksNeg, fV_neg, fP_neg, -1, fBeta_neg, fPolyLineNeg); + MakeTrack(fPathMarksPos, fV_pos, fP_pos, 1, fBeta_pos, fPolyLinePos); + MakeV0path(); + //fN = fPolyLineNeg.GetN(); +} + + +//______________________________________________________________________ +Float_t const V0::GetAlphaArmenteros() { + + Float_t posXv0 = fP_pos.x*GetPx() + fP_pos.y*GetPy() + fP_pos.z*GetPz(); + Float_t negXv0 = fP_neg.x*GetPx() + fP_neg.y*GetPy() + fP_neg.z*GetPz(); + + if (posXv0+negXv0 > 1.e-39) + return (posXv0-negXv0)/(posXv0+negXv0); + else return -999; +} + +//______________________________________________________________________ + Float_t const V0::GetPtArmenteros() { + + Float_t posXv0 = fP_pos.x*GetPx() + fP_pos.y*GetPy() + fP_pos.z*GetPz(); + Float_t v0mom2 = GetP2(); + + if (v0mom2 > 1.e-39) + return TMath::Sqrt( GetPosP2() - posXv0*posXv0/v0mom2 ) ; + else return -999; +} + + + + + +/*********************************************************************** +* +* V0List class +* +************************************************************************/ + +ClassImp(Reve::V0List) + +//______________________________________________________________________ +V0List::V0List() : + RenderElementListBase(), + fTitle(), + fRnrStyle(0), + fRnrDaughters(kTRUE), + fRnrV0vtx(kTRUE), + fRnrV0path(kTRUE), + fNegColor(0), + fPosColor(0) +{ + for (Int_t i=0; ifColor); + + fMin[0] = 0; fMax[0] = 10; // pt + fMin[1] = 0; fMax[1] = 10; // K0s mass + fMin[2] = 0; fMax[2] = 10; // lambda mass + fMin[3] = 0; fMax[3] = 10; // anti-lambda mass + fMin[4] = 0; fMax[4] = 10; // daughter DCA + fMin[5] = 0.8; fMax[5] = 1; // cos of pointing angle + + fMin[6] = 0; fMax[6] = 200; // radius + fMin[7] = -2; fMax[7] = 2; // PseudoRapidity + fMin[8] = 0; fMax[8] = 10; // NegPt + fMin[9] = -2; fMax[9] = 2; // NegPseudoRapidity + fMin[10] = 0; fMax[10] = 10; // PosPt + fMin[11] = -2; fMax[11] = 2; // PosPseudoRapidity + fMin[12] = 0; fMax[12] = 1e5; // index, would be good to be able to adjust it + + char *ch = "ptV0"; + fHist[0] = new TH1F(ch,ch, 100, fMin[0], fMax[0]); + ch = "K0sMass"; + fHist[1] = new TH1F(ch,ch, 100, fMin[1], fMax[1]); + ch = "LambdaMass"; + fHist[2] = new TH1F(ch,ch, 100, fMin[2], fMax[2]); + ch = "AntiLambdaMass"; + fHist[3] = new TH1F(ch,ch, 100, fMin[3], fMax[3]); + ch = "daughterDCA"; + fHist[4] = new TH1F(ch,ch, 100, fMin[4], fMax[4]); + ch = "cosPointingAngle"; + fHist[5] = new TH1F(ch,ch, 100, fMin[5], fMax[5]); + ch = "radius"; + fHist[6] = new TH1F(ch,ch, 100, fMin[6], fMax[6]); + ch = "PseudoRapidity"; + fHist[7] = new TH1F(ch,ch, 100, fMin[7], fMax[7]); + + ch = "NegPt"; + fHist[8] = new TH1F(ch,ch, 100, fMin[8], fMax[8]); + ch = "NegPseudoRapidity"; + fHist[9] = new TH1F(ch,ch, 100, fMin[9], fMax[9]); + ch = "PosPt"; + fHist[10] = new TH1F(ch,ch, 100, fMin[10], fMax[10]); + ch = "PosPseudoRapidity"; + fHist[11] = new TH1F(ch,ch, 100, fMin[11], fMax[11]); + ch = "v0Index"; + fHist[12] = new TH1F(ch,ch, 100, fMin[12], fMax[12]); + + + fMinX[0] = -1.2; + fMaxX[0] = 1.2; + fMinY[0] = 0; + fMaxY[0] = 0.4; + ch = "ArmenterosPodolansky"; + fHist2D[0] = new TH2F(ch,ch, 70, fMinX[0], fMaxX[0], 70, + fMinY[0], fMaxY[0]); + + for (Int_t i=0; iGetXaxis()->SetLabelSize(0.07); + fHist[i]->GetYaxis()->SetLabelSize(0.07); + fHist[i]->SetStats(0); + } + for (Int_t i=0; iGetXaxis()->SetLabelSize(0.07); + fHist2D[i]->GetYaxis()->SetLabelSize(0.07); + fHist2D[i]->SetStats(0); + } +} + +//______________________________________________________________________ +V0List::~V0List() { + + for (Int_t i=0; iGetRnrElement()) { + ((V0*)(*i))->Paint(option); + } + } + } + + if(fRnrDaughters) { + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + if((*i)->GetRnrElement()) { + ((V0*)(*i))->PaintDaughters(option); + } + } + } + + if(fRnrV0path) { + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + if((*i)->GetRnrElement()) { + ((V0*)(*i))->PaintPath(option); + } + } + } + } +} + + +//______________________________________________________________________ + +void V0List::AddElement(RenderElement* el) { + + static const Exc_t eH("V0List::AddElement "); + if (dynamic_cast(el) == 0) + throw(eH + "new element not a V0."); + RenderElementListBase::AddElement(el); +} + + + +void V0List::SetRnrV0vtx(Bool_t rnr) { + fRnrV0vtx = rnr; + gReve->Redraw3D(); +} + +void V0List::SetRnrV0path(Bool_t rnr) { + fRnrV0path = rnr; + gReve->Redraw3D(); +} + +void V0List::SetRnrDaughters(Bool_t rnr) { + fRnrDaughters = rnr; + gReve->Redraw3D(); +} + + +//______________________________________________________________________ + +void V0List::MakeV0s() { + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + ((V0*)(*i))->MakeV0(); + } + gReve->Redraw3D(); +} + + +void V0List::MakeMarkers() { + gReve->Redraw3D(); +} + + +//_________________________________________________________________________ +void V0List::AdjustHist(Int_t iHist) { + + if (! fHist[iHist]) return; + + TString name = fHist[iHist]->GetName(); + Int_t nBin = fHist[iHist]->GetXaxis()->GetNbins(); + delete fHist[iHist]; + fHist[iHist] = new TH1F(name.Data(), name.Data(), nBin, GetMin(iHist), + GetMax(iHist)); + fHist[iHist]->GetXaxis()->SetLabelSize(0.07); + fHist[iHist]->GetYaxis()->SetLabelSize(0.07); + fHist[iHist]->SetStats(0); + +} + + +//______________________________________________________________________ +void V0List::UnFill(V0* v0) { + + Int_t bin = fHist[0]->GetXaxis()->FindBin(v0->GetPt()); + fHist[0]->SetBinContent( bin, fHist[0]->GetBinContent(bin)-1 ); + + bin = fHist[1]->GetXaxis()->FindBin( v0->GetK0mass() ); + fHist[1]->SetBinContent( bin, fHist[1]->GetBinContent(bin)-1 ); + + bin = fHist[2]->GetXaxis()->FindBin( v0->GetLamMass() ); + fHist[2]->SetBinContent( bin, fHist[2]->GetBinContent(bin)-1 ); + + bin = fHist[3]->GetXaxis()->FindBin( v0->GetAntiLamMass() ); + fHist[3]->SetBinContent( bin, fHist[3]->GetBinContent(bin)-1 ); + + bin = fHist[4]->GetXaxis()->FindBin( v0->GetDaughterDCA() ); + fHist[4]->SetBinContent( bin, fHist[4]->GetBinContent(bin)-1 ); + + bin = fHist[5]->GetXaxis()->FindBin( v0->GetCosPointingAngle() ); + fHist[5]->SetBinContent( bin, fHist[5]->GetBinContent(bin)-1 ); + + + bin = fHist[6]->GetXaxis()->FindBin( v0->GetRadius() );// radius + fHist[6]->SetBinContent( bin, fHist[6]->GetBinContent(bin)-1 ); + + bin = fHist[7]->GetXaxis()->FindBin( v0->GetPseudoRapidity() ); // PseudoRapidity + fHist[7]->SetBinContent( bin, fHist[7]->GetBinContent(bin)-1 ); + + bin = fHist[8]->GetXaxis()->FindBin( v0->GetNegPt() );// NegPt + fHist[8]->SetBinContent( bin, fHist[8]->GetBinContent(bin)-1 ); + + bin = fHist[9]->GetXaxis()->FindBin( v0->GetNegPseudoRapidity() );// NegPseudoRapidity + fHist[9]->SetBinContent( bin, fHist[9]->GetBinContent(bin)-1 ); + + bin = fHist[10]->GetXaxis()->FindBin( v0->GetPosPt() ); // PosPt + fHist[10]->SetBinContent( bin, fHist[10]->GetBinContent(bin)-1 ); + + bin = fHist[11]->GetXaxis()->FindBin( v0->GetPosPseudoRapidity() ); // PosPseudoRapidity + fHist[11]->SetBinContent( bin, fHist[11]->GetBinContent(bin)-1 ); + + bin = fHist[12]->GetXaxis()->FindBin( v0->GetESDIndex() ); // ESD index + fHist[12]->SetBinContent( bin, fHist[12]->GetBinContent(bin)-1 ); + + //--- + bin = fHist2D[0]->GetXaxis()->FindBin( v0->GetAlphaArmenteros() ); + Int_t binY = fHist2D[0]->GetYaxis()->FindBin( v0->GetPtArmenteros() ); + fHist2D[0]->SetBinContent( bin, binY, fHist2D[0]->GetBinContent(bin,binY)-1 ); +} + + +//______________________________________________________________________ +void V0List::Filter(V0* v0) { + + Float_t pt = v0->GetPt(); + if ((ptfMax[0])) return; + + Float_t k0sMass = v0->GetK0mass(); + if ( (k0sMassfMax[1]) ) return; + + Float_t lamMass = v0->GetLamMass(); + if ( (lamMassfMax[2]) ) return; + + Float_t alamMass = v0->GetAntiLamMass(); + if ( (alamMassfMax[3]) ) return; + + Float_t daughtDCA = v0->GetDaughterDCA(); + if ( (daughtDCAfMax[4]) ) return; + + Float_t cosPointing = v0->GetCosPointingAngle(); + if ( (cosPointingfMax[5]) ) return; + + + Float_t radius = v0->GetRadius(); + if ( (radiusfMax[6]) ) return; + + Float_t pseudoRapidity = v0->GetPseudoRapidity(); + if ( (pseudoRapidityfMax[7]) ) return; + + Float_t negPt = v0->GetNegPt(); + if ( (negPtfMax[8]) ) return; + + Float_t negPseudoRapidity = v0->GetNegPseudoRapidity(); + if ( (negPseudoRapidityfMax[9]) ) return; + + Float_t posPt = v0->GetPosPt(); + if ( (posPtfMax[10]) ) return; + + Float_t posPseudoRapidity = v0->GetPosPseudoRapidity(); + if ( (posPseudoRapidityfMax[11]) ) return; + + Float_t esdIndex = v0->GetESDIndex(); + if ( (esdIndexfMax[12]) ) return; + + Float_t alphaArm = v0->GetAlphaArmenteros(); +// if ( (alphaArmfMaxX[0]) ) return; + + Float_t ptArm = v0->GetPtArmenteros(); +// if ( (ptArmfMaxY[0]) ) return; + + v0->SetRnrElement(kTRUE); + fHist[0]->Fill(pt); + fHist[1]->Fill(k0sMass); + fHist[2]->Fill(lamMass); + fHist[3]->Fill(alamMass); + fHist[4]->Fill(daughtDCA); + fHist[5]->Fill(cosPointing); + fHist[6]->Fill(radius); + fHist[7]->Fill(pseudoRapidity); + fHist[8]->Fill(negPt); + fHist[9]->Fill(negPseudoRapidity); + fHist[10]->Fill(posPt); + fHist[11]->Fill(posPseudoRapidity); + fHist[12]->Fill(esdIndex); + fHist2D[0]->Fill(alphaArm, ptArm); +} + +//______________________________________________________________________ +void V0List::FilterAll() { + + for (Int_t i=0; iReset(); + + for (Int_t i=0; iReset(); + + V0* myV0; + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + Filter(myV0); + } +} + + +//______________________________________________________________________ +void V0List::GetV0IndexRange(Int_t &imin, Int_t &imax) { + + Int_t index; + V0* myV0; + lpRE_i i=fChildren.begin(); + myV0 = (V0*)(*i); + index = myV0->GetESDIndex(); + imin = index; + imax = index; + + for(; i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + index = myV0->GetESDIndex(); + if (indeximax) imax = index; + } +} + + +//______________________________________________________________________ +void V0List::PtFilter(Float_t min, Float_t max) { + + fMin[0] = min; + fMax[0] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetPt(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + + +//______________________________________________________________________ +void V0List::K0sMFilter(Float_t min, Float_t max) { + + fMin[1] = min; + fMax[1] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetK0mass(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + +//______________________________________________________________________ +void V0List::LamMFilter(Float_t min, Float_t max) { + + fMin[2] = min; + fMax[2] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetLamMass(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + + + +//______________________________________________________________________ +void V0List::ALamMFilter(Float_t min, Float_t max) { + + fMin[3] = min; + fMax[3] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetAntiLamMass(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + +//______________________________________________________________________ +void V0List::CosPointingFilter(Float_t min, Float_t max) { + + fMin[5] = min; + fMax[5] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetCosPointingAngle(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + +//______________________________________________________________________ +void V0List::DaughterDCAFilter(Float_t min, Float_t max) { + + fMin[4] = min; + fMax[4] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetDaughterDCA(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + +//______________________________________________________________________ +void V0List::RadiusFilter(Float_t min, Float_t max) { + + fMin[6] = min; + fMax[6] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetRadius(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + +//______________________________________________________________________ +void V0List::EtaFilter(Float_t min, Float_t max) { + + fMin[7] = min; + fMax[7] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetPseudoRapidity(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + +//______________________________________________________________________ +void V0List::NegPtFilter(Float_t min, Float_t max) { + + fMin[8] = min; + fMax[8] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetNegPt(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + +//______________________________________________________________________ +void V0List::NegEtaFilter(Float_t min, Float_t max) { + + fMin[9] = min; + fMax[9] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetNegPseudoRapidity(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + +//______________________________________________________________________ +void V0List::PosPtFilter(Float_t min, Float_t max) { + + fMin[10] = min; + fMax[10] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetPosPt(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + +//______________________________________________________________________ +void V0List::PosEtaFilter(Float_t min, Float_t max) { + + fMin[11] = min; + fMax[11] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetPosPseudoRapidity(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + +//______________________________________________________________________ +void V0List::IndexFilter(Float_t min, Float_t max) { + + fMin[12] = min; + fMax[12] = max; + + Float_t val; + Bool_t wasSelected; + Bool_t isSelected; + V0* myV0; + + for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) { + + myV0 = (V0*)(*i); + val = myV0->GetESDIndex(); + wasSelected = myV0->GetRnrElement(); + isSelected = ( (val>=min) && (val<=max) ); + + if (wasSelected) { + if (! isSelected) { + UnFill(myV0); + myV0->SetRnrElement(isSelected); + } + } else { + if (isSelected) Filter(myV0); + } + } +} + diff --git a/EVE/Reve/V0.h b/EVE/Reve/V0.h new file mode 100644 index 00000000000..154dbc53950 --- /dev/null +++ b/EVE/Reve/V0.h @@ -0,0 +1,428 @@ + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +/*********************************************************************** +* This code defines the reconstructed v0 visualized with EVE +* +* Ludovic Gaudichet (gaudichet@to.infn.it) +************************************************************************/ + + +#ifndef REVE_V0_H +#define REVE_V0_H + +#include +#include +#include + +#include +#include + +class TH1F; +class TH2F; + + +namespace Reve { + +class V0List; + +class V0 : public RenderElement, public TPolyMarker3D +{ + friend class V0List; + + V0(const V0&); // Not implemented + V0& operator=(const V0&); // Not implemented + +public: + V0(); + V0(Reve::RecTrack* tNeg, Reve::RecTrack* tPos,Reve::RecV0* v0, TrackRnrStyle* rs); + virtual ~V0(); + + typedef std::vector vpPathMark_t; + typedef std::vector::iterator vpPathMark_i; + void AddPathMarkPos(Reve::PathMark* pm) { fPathMarksPos.push_back(pm); } + void AddPathMarkNeg(Reve::PathMark* pm) { fPathMarksNeg.push_back(pm); } + + void Reset(TPolyLine3D* polyLine); + + void MakeTrack(vpPathMark_t& pathMark, Reve::Vector& vtx, Reve::Vector& p, + Int_t charge, Float_t beta, TPolyLine3D& polyLine); + + void MakeV0path(); + void MakeV0(); + + virtual void PaintDaughters(Option_t* option="") { + if(fRnrElement) {fPolyLineNeg.Paint(option);fPolyLinePos.Paint(option);} } + virtual void Paint(Option_t* option="") { + if(fRnrElement) TPolyMarker3D::Paint(option);} + virtual void PaintPath(Option_t* option="") { + if(fRnrElement) fPolyLineV0.Paint(option);} + + virtual void SetMainColor(Color_t col) { + fMarkerColor = col; fMainColorPtr = &fMarkerColor; + fPolyLineV0.SetLineColor(fMarkerColor);} + virtual void SetTracksColor(Color_t cNeg, Color_t cPos) { + fPolyLineNeg.SetLineColor(cNeg); fPolyLinePos.SetLineColor(cPos); } + void SetRnrStyle(TrackRnrStyle* rs) { fRnrStyle = rs; } + void SetESDIndex(Int_t ind) { fESDIndex = ind;} + void SetDaughterDCA(Float_t dca); + void SetCosPointingAngle(Float_t cos); + void SetDecayLength(Float_t len); + void SetDecayLength(Float_t primx, Float_t primy, Float_t primz); + + Float_t const GetDaughterDCA(); + Float_t const GetCosPointingAngle(); + Float_t const GetRadius(); + Float_t const GetDecayLength(); + + Float_t const GetP2(); + Float_t const GetMomentum(); + Float_t const GetPt(); + Float_t const GetPt2(); + Float_t const GetPx(); + Float_t const GetPy(); + Float_t const GetPz(); + Float_t const GetPseudoRapidity(); + Float_t const GetAlphaArmenteros(); + Float_t const GetPtArmenteros(); + + Float_t const GetK0sE() {return 0;}; + Float_t const GetLamE() {return 0;}; + Float_t const GetAntiLamE() {return 0;}; + Float_t const GetK0mass(); + Float_t const GetLamMass(); + Float_t const GetAntiLamMass(); + + Float_t const GetPionMinusE(); + Float_t const GetPionPlusE(); + Float_t const GetProtonE(); + Float_t const GetPBarE(); + + Float_t const GetPosDCAtoPrim(); + Float_t const GetPosP2(); + Float_t const GetPosP(); + Float_t const GetPosPt(); + Float_t const GetPosPseudoRapidity(); + + Float_t const GetNegDCAtoPrim(); + Float_t const GetNegP2(); + Float_t const GetNegP(); + Float_t const GetNegPt(); + Float_t const GetNegPseudoRapidity(); + Int_t const GetESDIndex() {return fESDIndex;}; + + virtual const Text_t* GetName() const { return Form("ESDv0_%i",fESDIndex); } + virtual const Text_t* GetTitle() const { return Form("ESDv0_%i",fESDIndex); } + Int_t GetLabelPos() const { return fLabel_pos; } + Int_t GetLabelNeg() const { return fLabel_neg; } + TrackRnrStyle* GetRnrStyle() const { return fRnrStyle; } + TPolyLine3D* GetPolyLineNeg() {return &fPolyLineNeg;} + TPolyLine3D* GetPolyLinePos() {return &fPolyLinePos;} + TPolyLine3D* GetPolyLineV0() {return &fPolyLineV0;} + +protected: + + Reve::Vector fV_neg; // Vertex of negative track + Reve::Vector fP_neg; // Momentum of negative track + Reve::Vector fV_pos; // Vertex of positive track + Reve::Vector fP_pos; // Momentum of positive track + + Reve::Vector fV_v0; // Point of closest approach + Reve::Vector fV0_birth; // Reconstucted birth point of neutral particle + + Float_t fBeta_neg; + Float_t fBeta_pos; + + Int_t fLabel_neg; + Int_t fLabel_pos; + + vpPathMark_t fPathMarksNeg; + vpPathMark_t fPathMarksPos; + TrackRnrStyle* fRnrStyle; + + TPolyLine3D fPolyLineNeg; + TPolyLine3D fPolyLinePos; + TPolyLine3D fPolyLineV0; + + Int_t fESDIndex; + Float_t fDaughterDCA; + Float_t fCosPointingAngle; + Float_t fDecayLength; + + static const Float_t fgkMassPion2; + static const Float_t fgkMassProton2; + + ClassDef(V0, 1) +}; // endclass V0 + + + +//______________________________________________________________________ +inline void V0::SetDaughterDCA(Float_t dca) { + fDaughterDCA = dca; +} + +inline void V0::SetCosPointingAngle(Float_t cos) { + fCosPointingAngle = cos; +} + +inline void V0::SetDecayLength(Float_t len) { + fDecayLength = len; +} + + +//______________________________________________________________________ +inline Float_t const V0::GetPt2() { + Float_t px = fP_neg.x+fP_pos.x, py = fP_neg.y+fP_pos.y; + return (px*px+py*py); +} + +inline Float_t const V0::GetP2() { + + Float_t px = fP_neg.x+fP_pos.x, py = fP_neg.y+fP_pos.y, pz = fP_neg.z+fP_pos.z; + return (px*px+py*py+pz*pz); +} + +inline Float_t const V0::GetPt() { + return sqrt(GetPt2()); +} + +inline Float_t const V0::GetMomentum() { + return sqrt(GetP2()); +} + +inline Float_t const V0::GetPx() { + return (fP_neg.x+fP_pos.x); +} + +inline Float_t const V0::GetPy() { + return (fP_neg.y+fP_pos.y); +} + +inline Float_t const V0::GetPz() { + return (fP_neg.z+fP_pos.z); +} + +//______________________________________________________________________ + +inline Float_t const V0::GetDaughterDCA() { +return fDaughterDCA; +} + +inline Float_t const V0::GetCosPointingAngle() { +return fCosPointingAngle; +} + +inline Float_t const V0::GetRadius() { + return sqrt(fV_v0.x*fV_v0.x + fV_v0.y*fV_v0.y); +} + +inline Float_t const V0::GetDecayLength() { +return fDecayLength; +} + +inline Float_t const V0::GetPseudoRapidity() { + Float_t theta = acos( GetPz()/GetMomentum() ); + return ( -log(tan(theta/2.)) ); +} + +//______________________________________________________________________ + +inline Float_t const V0::GetPionMinusE() { + return sqrt(fgkMassPion2+GetNegP2()); +} + +inline Float_t const V0::GetPionPlusE() { + return sqrt(fgkMassPion2+GetPosP2()); +} +inline Float_t const V0::GetProtonE() { + return sqrt(fgkMassProton2+GetPosP2()); + +} +inline Float_t const V0::GetPBarE() { + return sqrt(fgkMassProton2+GetNegP2()); +} + +//______________________________________________________________________ + +inline Float_t const V0::GetPosP2() { + return (fP_pos.x*fP_pos.x + fP_pos.y*fP_pos.y + fP_pos.z*fP_pos.z); +} + +inline Float_t const V0::GetPosP() { + return sqrt(GetPosP2()); +} + +inline Float_t const V0::GetPosPt() { + return sqrt(fP_pos.x*fP_pos.x + fP_pos.y*fP_pos.y); +} + +inline Float_t const V0::GetPosPseudoRapidity() { + Float_t theta = acos( fP_pos.z/GetPosP() ); + return ( -log(tan(theta/2.)) ); +} + +inline Float_t const V0::GetPosDCAtoPrim() { + return 0; +} + +//______________________________________________________________________ +inline Float_t const V0::GetNegP2() { + return (fP_neg.x*fP_neg.x + fP_neg.y*fP_neg.y + fP_neg.z*fP_neg.z); +} + +inline Float_t const V0::GetNegP() { + return sqrt(GetNegP2()); +} + +inline Float_t const V0::GetNegPt() { + return sqrt(fP_neg.x*fP_neg.x + fP_neg.y*fP_neg.y); +} + +inline Float_t const V0::GetNegPseudoRapidity() { + Float_t theta = acos( fP_neg.z/GetNegP() ); + return ( -log(tan(theta/2.)) ); +} + +inline Float_t const V0::GetNegDCAtoPrim() { + return 0; +} + +//______________________________________________________________________ + +inline Float_t const V0::GetK0mass() { + Float_t energy = GetPionMinusE() + GetPionPlusE(); + return sqrt( energy*energy - GetP2() ); +} + +inline Float_t const V0::GetLamMass() { + Float_t energy = GetPionMinusE() + GetProtonE(); + return sqrt( energy*energy - GetP2() ); +} + +inline Float_t const V0::GetAntiLamMass() { + Float_t energy = GetPionPlusE() + GetPBarE(); + return sqrt( energy*energy - GetP2() ); +} + + + + +/**************************************************************************/ +// V0List +/**************************************************************************/ + +class V0List : public TNamed, public RenderElementListBase +{ + V0List(const V0List&); // Not implemented + V0List& operator=(const V0List&); // Not implemented + +public: + V0List(); + V0List(TrackRnrStyle* rs); + V0List(const Text_t* name, TrackRnrStyle* rs=0); + virtual ~V0List(); + + virtual const Text_t* GetTitle() const { return fTitle; } + virtual void SetTitle(const Text_t* t) { fTitle = t; } + virtual void SetTracksColor(Color_t cNeg, Color_t cPos) { + fNegColor = cNeg; fPosColor = cPos;} + + virtual Bool_t CanEditMainColor() { return kTRUE; } + + virtual void Paint(Option_t* option=""); + + virtual void AddElement(RenderElement* el); + + void SetRnrStyle(TrackRnrStyle* rst) { fRnrStyle= rst; } + TrackRnrStyle* GetRnrStyle() { return fRnrStyle; } + + Bool_t GetRnrV0vtx() const { return fRnrV0vtx; } + Bool_t GetRnrV0path() const { return fRnrV0path; } + Bool_t GetRnrDaughters() const { return fRnrDaughters; } + + void SetRnrV0vtx(Bool_t); + void SetRnrV0path(Bool_t); + void SetRnrDaughters(Bool_t); + void SetMin(Int_t i, Float_t val) { + if ((i>=0)&&(i=0)&&(i=0)&&(i=0)&&(i=0)&&(i=0)&&(ifMaxZ; } + Float_t GetMaxZ() const { return fRnrStyle->fMaxR; } + Float_t GetMaxOrbs() const { return fRnrStyle->fMaxOrbs; } + Float_t GetMinAng() const { return fRnrStyle->fMinAng; } + Float_t GetDelta() const { return fRnrStyle->fDelta; } + Bool_t GetFitDaughters() const { return fRnrStyle->fFitDaughters; } + Bool_t GetFitDecay() const { return fRnrStyle->fFitDecay; } + + void AdjustHist(Int_t iHist); + void UnFill(V0* v0); + void Filter(V0* v0); + void FilterAll(); + void PtFilter(Float_t min, Float_t max); + + void K0sMFilter(Float_t min, Float_t max); + void LamMFilter(Float_t min, Float_t max); + void ALamMFilter(Float_t min, Float_t max); + void CosPointingFilter(Float_t min, Float_t max); + void DaughterDCAFilter(Float_t min, Float_t max); + void RadiusFilter(Float_t min, Float_t max); + void EtaFilter(Float_t min, Float_t max); + void NegPtFilter(Float_t min, Float_t max); + void NegEtaFilter(Float_t min, Float_t max); + void PosPtFilter(Float_t min, Float_t max); + void PosEtaFilter(Float_t min, Float_t max); + void IndexFilter(Float_t min, Float_t max); + + +private: + void Init(); + +protected: + TString fTitle; + + TrackRnrStyle* fRnrStyle; + + Bool_t fRnrDaughters; + Bool_t fRnrV0vtx; + Bool_t fRnrV0path; + + Color_t fNegColor; + Color_t fPosColor; + + static const Int_t fgkNcutVar = 13; + TH1F *fHist[fgkNcutVar]; + Float_t fMin[fgkNcutVar]; + Float_t fMax[fgkNcutVar]; + + static const Int_t fgkNcutVar2D = 1; + TH2F *fHist2D[fgkNcutVar2D]; + Float_t fMinX[fgkNcutVar2D]; + Float_t fMinY[fgkNcutVar2D]; + Float_t fMaxX[fgkNcutVar2D]; + Float_t fMaxY[fgkNcutVar2D]; + + ClassDef(V0List, 1) +}; + + +} // namespace Reve + +#endif diff --git a/EVE/Reve/V0Editors.cxx b/EVE/Reve/V0Editors.cxx new file mode 100644 index 00000000000..e57176b484e --- /dev/null +++ b/EVE/Reve/V0Editors.cxx @@ -0,0 +1,558 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + + +/*********************************************************************** + This editor appears in the Reve window when v0 are visualize. +It allows to select the v0 as a function of some useful parameters. + +Ludovic Gaudichet (gaudichet@to.infn.it) +************************************************************************/ + + +#include "V0Editors.h" +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +using namespace Reve; + +//______________________________________________________________________ +// V0ListEditor +// + +ClassImp(V0ListEditor) + +V0ListEditor::V0ListEditor(const TGWindow *p, + Int_t width, Int_t height, + UInt_t options, Pixel_t back) : + TGedFrame(p, width, height, options | kVerticalFrame, back), + fMList(0), + fRnrV0sDaugh(0), + fRnrV0vtx(0), + fRnrV0path(0), + fMainTabA(0), + fMainTabB(0) +{ + MakeTitle("V0List"); + + //TGHorizontalFrame* frame = new TGHorizontalFrame(this); + + // --- Rendering control + + fRnrV0path = new TGCheckButton(this, "Render v0 path"); + AddFrame(fRnrV0path, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); + fRnrV0path->Connect("Toggled(Bool_t)", + "Reve::V0ListEditor", this, "DoRnrV0path()"); + + fRnrV0vtx = new TGCheckButton(this, "Render v0 vertices"); + AddFrame(fRnrV0vtx, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); + fRnrV0vtx->Connect("Toggled(Bool_t)", + "Reve::V0ListEditor", this, "DoRnrV0vtx()"); + + fRnrV0sDaugh = new TGCheckButton(this, "Render v0 daughters"); + AddFrame(fRnrV0sDaugh, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); + fRnrV0sDaugh->Connect("Toggled(Bool_t)", + "Reve::V0ListEditor", this, "DoRnrDaughters()"); + + for (Int_t i=0; iConnect("Clicked()", "Reve::V0ListEditor", this, "ResetCuts()"); + AddFrame(resetCutsButton, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); +} + +V0ListEditor::~V0ListEditor() {} + + +//_________________________________________________________________________ +void V0ListEditor::SetModel(TObject* obj) +{ + fMList = dynamic_cast(obj); + + for (Int_t i=0; iSetValues( fMList->GetMin(i), fMList->GetMax(i) ); + } + fRnrV0sDaugh->SetState(fMList->GetRnrDaughters() ? kButtonDown : kButtonUp); + fRnrV0vtx->SetState(fMList->GetRnrV0vtx() ? kButtonDown : kButtonUp); + fRnrV0path->SetState(fMList->GetRnrV0path() ? kButtonDown : kButtonUp); + + FillCanvas(); +} + + +//_________________________________________________________________________ +TGCompositeFrame* V0ListEditor::AddTab(TGTab* tab, Int_t i, Int_t can, + char *name) { + + TGCompositeFrame* frameTab = tab->AddTab(name); + frameTab->SetLayoutManager(new TGVerticalLayout( frameTab )); + + TRootEmbeddedCanvas** embeddedCanvas = 0; + + if (can==1) embeddedCanvas = &fCanvasA[i]; + else if (can==2) embeddedCanvas = &fCanvasB[i]; + + *embeddedCanvas = new TRootEmbeddedCanvas("EmbeddedCanvas", frameTab, 200, 200); + TCanvas *c1 = (*embeddedCanvas)->GetCanvas(); + c1->SetBorderMode(0); + c1->SetTicks(1,0); + c1->SetGrid(); + c1->SetBorderMode(0); + + frameTab->AddFrame(*embeddedCanvas, new TGLayoutHints(kLHintsTop|kLHintsExpandX, + 0, 0, 0, 0)); + return frameTab; +} + + +//_________________________________________________________________________ +TGCompositeFrame** V0ListEditor::CreateTab(TGTab **pMainTab, TGTab **ptab, Int_t can) { + + //------ + // tab widget + pMainTab[0] = new TGTab(this,0,0); + pMainTab[0]->Connect("Selected(Int_t)", "Reve::V0ListEditor", this, "UpdateSelectedTab()"); + this->AddFrame(pMainTab[0], new TGLayoutHints( kLHintsTop | kLHintsExpandX,2,2,2,2)); + + + //------ + // container of "Tab1" + TGCompositeFrame *frameTab1 = pMainTab[0]->AddTab("ident."); + frameTab1->SetLayoutManager(new TGVerticalLayout(frameTab1)); + + // tab widget + + ptab[0] = new TGTab(frameTab1,2,2); + ptab[0]->Resize(ptab[0]->GetDefaultSize()); + // The following is for updating the canvas of a tab if this one is selected + // (it updates every canvas) + ptab[0]->Connect("Selected(Int_t)", "Reve::V0ListEditor", this, "UpdateSelectedTab()"); + frameTab1->AddFrame(ptab[0], new TGLayoutHints(kLHintsLeft| kLHintsExpandX,0,0,0,0)); + + //------ + // container of "Tab2" + TGCompositeFrame *frameTab2 = pMainTab[0]->AddTab("v0"); + frameTab2->SetLayoutManager(new TGVerticalLayout(frameTab2)); + + // tab widget + ptab[1] = new TGTab(frameTab2,440,299); + ptab[1]->Resize(ptab[1]->GetDefaultSize()); + ptab[1]->Connect("Selected(Int_t)", "Reve::V0ListEditor", this, "UpdateSelectedTab()"); + frameTab2->AddFrame(ptab[1], new TGLayoutHints(kLHintsLeft| kLHintsExpandX ,0,0,0,0)); + + //------ + // container of "Tab3" + TGCompositeFrame *frameTab3 = pMainTab[0]->AddTab("daughters"); + frameTab3->SetLayoutManager(new TGVerticalLayout(frameTab3)); + + // tab widget + ptab[2] = new TGTab(frameTab3,440,299); + ptab[2]->Resize(ptab[2]->GetDefaultSize()); + ptab[2]->Connect("Selected(Int_t)", "Reve::V0ListEditor", this, "UpdateSelectedTab()"); + frameTab3->AddFrame(ptab[2], new TGLayoutHints(kLHintsLeft| kLHintsExpandX ,0,0,0,0)); + + //------ + TGCompositeFrame **frameTab = new TGCompositeFrame*[fgkNCanvas]; + + frameTab[0] = AddTab(ptab[0], 0, can, "K0s"); + frameTab[1] = AddTab(ptab[0], 1, can, "Lambda"); + frameTab[2] = AddTab(ptab[0], 2, can, "Anti-Lambda"); + frameTab[3] = AddTab(ptab[0], 3, can, "Arm-Podo"); + frameTab[4] = AddTab(ptab[0], 4, can, "Index"); + frameTab[5] = AddTab(ptab[1], 5, can, "cosPointing"); + frameTab[6] = AddTab(ptab[1], 6, can, "daughterDCA"); + frameTab[7] = AddTab(ptab[1], 7, can, "radius"); + frameTab[8] = AddTab(ptab[1], 8, can, "Pt"); + frameTab[9] = AddTab(ptab[1], 9, can, "eta"); + frameTab[10] = AddTab(ptab[2], 10, can, "neg Pt"); + frameTab[11] = AddTab(ptab[2], 11, can, "neg eta"); + frameTab[12] = AddTab(ptab[2], 12, can, "pos Pt"); + frameTab[13] = AddTab(ptab[2], 13, can, "pos eta"); + + pMainTab[0]->SetTab(0); + ptab[0]->SetTab(0); + ptab[1]->SetTab(0); + ptab[2]->SetTab(0); + + Pixel_t darkgrey; + gClient->GetColorByName("grey50", darkgrey); + ptab[0]->SetBackgroundColor(darkgrey); + ptab[1]->SetBackgroundColor(darkgrey); + ptab[2]->SetBackgroundColor(darkgrey); + + return frameTab; +} + + +//_________________________________________________________________________ +void V0ListEditor::AddValuator(TGCompositeFrame* frame, char *name, + Float_t min, Float_t max, Int_t pres, + char *func, Int_t iHist) { + + TGCompositeFrame* downFrame = new TGCompositeFrame(frame, + 60, 60, kHorizontalFrame); + + // --- Selectors + fRange[iHist] = new RGDoubleValuator(downFrame, name, 200, 0); + fRange[iHist]->SetNELength(6); + fRange[iHist]->Build(); + fRange[iHist]->GetSlider()->SetWidth(200); + + fRange[iHist]->SetLimits(min, max, TGNumberFormat::kNESRealTwo); + if (pres==0) + fRange[iHist]->SetLimits(min, max, TGNumberFormat::kNESInteger); + else if (pres==3) + fRange[iHist]->SetLimits(min, max, TGNumberFormat::kNESRealThree); + else if (pres==4) + fRange[iHist]->SetLimits(min, max, TGNumberFormat::kNESRealFour); + else if (pres==5) + fRange[iHist]->SetLimits(min, max, TGNumberFormat::kNESReal); + + fRange[iHist]->Connect("ValueSet()", + "Reve::V0ListEditor", this, func); + downFrame->AddFrame(fRange[iHist], new TGLayoutHints(kLHintsLeft, + 0, 0, 0, 0)); + + TGTextButton* adjustButton = new TGTextButton(downFrame, "Adjust Hist", 40); + + char ch[40]; + sprintf(ch,"AdjustHist(=%i)",iHist); + adjustButton->Connect("Clicked()", "Reve::V0ListEditor", this, ch); + downFrame->AddFrame(adjustButton, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0)); + + frame->AddFrame(downFrame, new TGLayoutHints(kLHintsTop| kLHintsExpandY, + 0, 0, 0, 0)); +} + + +//_________________________________________________________________________ +void V0ListEditor::AddSelectTab() { + + TGCompositeFrame** tab = CreateTab(&fMainTabA, fTabA, 1); + + AddValuator(tab[0], "mass K0s", 0, 5, 3, "MassK0sRange()", 1); + AddValuator(tab[1], "mass Lambda", 0, 5, 3, "MassLamRange()", 2); + AddValuator(tab[2], "mass Anti-Lambda", 0, 5, 3, "MassAntiLamRange()", 3); + AddValuator(tab[4], "ESD v0 index", 0,1e5, 0, "ESDv0IndexRange()", 12); + AddValuator(tab[5], "cos pointing angle", 0.8,1, 5, "CosPointingRange()", 5); + AddValuator(tab[6], "daughter DCA", 0, 10, 2, "DaughterDcaRange()", 4); + AddValuator(tab[7], "radius", 0,100, 2, "RadiusRange()", 6); + AddValuator(tab[8], "Pt range", 0, 10, 2, "PtRange()", 0); + AddValuator(tab[9], "eta", -2, 2, 2, "EtaRange()", 7); + AddValuator(tab[10], "neg Pt", 0, 10, 2, "NegPtRange()", 8); + AddValuator(tab[11], "neg eta", -2, 2, 2, "NegEtaRange()", 9); + AddValuator(tab[12], "pos Pt", 0, 10, 2, "PosPtRange()", 10); + AddValuator(tab[13], "pos eta", -2, 2, 2, "PosEtaRange()", 11); + + delete[] tab; +} + + +//_________________________________________________________________________ +void V0ListEditor::AddSeeTab() { + + TGCompositeFrame** tab = CreateTab(&fMainTabB, fTabB, 2); + delete[] tab; +} + + +//_________________________________________________________________________ +void V0ListEditor::AdjustHist(Int_t iHist) { + + if (! fMList) return; + fMList->AdjustHist(iHist); + + FillCanvas(); +} + +//_________________________________________________________________________ +void V0ListEditor::ResetCuts() { + + if (! fMList) return; + + Int_t imin, imax; + fMList->GetV0IndexRange(imin, imax); + if (iminSetMin(12, minH); + fMList->SetMax(12, maxH); + fRange[12]->SetLimits(minH, maxH, TGNumberFormat::kNESInteger); + fRange[12]->SetValues(minH, maxH); + AdjustHist(12); + + } + FillCanvas(); +} + + + +//_________________________________________________________________________ +void V0ListEditor::FillCanvas() { + + fMList->FilterAll(); + + TCanvas *c1, *c1b; + TH1F *hist = 0; + TH2F *hist2D = 0; + Bool_t is2D; + + Int_t canvasMap[fgkNCanvas]={1,2,3,1000,12,5,4,6,0, 7,8,9,10,11}; + + for (Int_t i=0; i999; + + if (is2D) hist2D = fMList->GetHist2D(canvasMap[i]-1000); + else hist = fMList->GetHist(canvasMap[i]); + + c1 = fCanvasA[i]->GetCanvas(); + c1->cd(); + if (is2D) hist2D->Draw("colz"); else hist->Draw(); + c1->Modified(); + c1->Update(); + + c1b = fCanvasB[i]->GetCanvas(); + c1b->cd(); + if (is2D) hist2D->Draw("colz"); else hist->Draw(); + c1b->Modified(); + c1b->Update(); + } + UpdateSelectedTab(); +} + + +//_________________________________________________________________________ +void V0ListEditor::UpdateSelectedTab() { + + Pixel_t yellow; + Pixel_t grey; + gClient->GetColorByName("yellow", yellow); + gClient->GetColorByName("grey", grey); + + TGTabElement *tabElem; + for (Int_t i=0; iGetNumberOfTabs(); i++) { + + tabElem = fMainTabA->GetTabTab(i); + tabElem->ChangeBackground(grey); + + for (Int_t j=0; jGetNumberOfTabs();j++) { + tabElem = fTabA[i]->GetTabTab(j); + tabElem->ChangeBackground(grey); + } + } + + Int_t currentTab = fMainTabA->GetCurrent(); + Int_t currentSubTab = fTabA[currentTab]->GetCurrent(); + tabElem = fMainTabA->GetTabTab(currentTab); + tabElem->ChangeBackground(yellow); + tabElem = fTabA[currentTab]->GetTabTab(currentSubTab); + tabElem->ChangeBackground(yellow); + + TCanvas *c1; + Int_t iCan = 0; + Int_t i=0; + + while (currentTab>i) { + iCan += fTabA[i]->GetNumberOfTabs(); + i++; + } + iCan += currentSubTab; + c1 = fCanvasA[iCan]->GetCanvas(); + c1->GetCanvas()->Modified(); + c1->GetCanvas()->Update(); + + //--- + + for (Int_t i=0; iGetNumberOfTabs(); i++) { + + tabElem = fMainTabB->GetTabTab(i); + tabElem->ChangeBackground(grey); + + for (Int_t j=0; jGetNumberOfTabs();j++) { + tabElem = fTabB[i]->GetTabTab(j); + tabElem->ChangeBackground(grey); + } + } + + currentTab = fMainTabB->GetCurrent(); + currentSubTab = fTabB[currentTab]->GetCurrent(); + tabElem = fMainTabB->GetTabTab(currentTab); + tabElem->ChangeBackground(yellow); + tabElem = fTabB[currentTab]->GetTabTab(currentSubTab); + tabElem->ChangeBackground(yellow); + + iCan = 0; + i=0; + + while (currentTab>i) { + iCan += fTabB[i]->GetNumberOfTabs(); + i++; + } + iCan += currentSubTab; + c1 = fCanvasB[iCan]->GetCanvas(); + c1->GetCanvas()->Modified(); + c1->GetCanvas()->Update(); +} + + +//_________________________________________________________________________ +void V0ListEditor::UpdateAll(Int_t iCanA) { + + TCanvas *c1 = fCanvasA[iCanA]->GetCanvas(); + c1->Modified(); + c1->Update(); + + static Int_t iCan, i; + iCan=0; + i=0; + while (fMainTabB->GetCurrent()>i) { + iCan += fTabB[i]->GetNumberOfTabs(); + i++; + } + iCan += fTabB[i]->GetCurrent(); + c1 = fCanvasB[iCan]->GetCanvas(); + c1->GetCanvas()->Modified(); + c1->GetCanvas()->Update(); + + Update(); +} + + +//_________________________________________________________________________ + +void V0ListEditor::DoRnrV0vtx() +{ + fMList->SetRnrV0vtx(fRnrV0vtx->IsOn()); + Update(); +} + +void V0ListEditor::DoRnrV0path() +{ + fMList->SetRnrV0path(fRnrV0path->IsOn()); + Update(); +} + +void V0ListEditor::DoRnrDaughters() +{ + fMList->SetRnrDaughters(fRnrV0sDaugh->IsOn()); + Update(); +} + + +//_________________________________________________________________________ +void V0ListEditor::MassK0sRange() { + + fMList->K0sMFilter(fRange[1]->GetMin(), fRange[1]->GetMax()); + UpdateAll(0); +} + +//_________________________________________________________________________ + void V0ListEditor::MassLamRange() { + fMList->LamMFilter(fRange[2]->GetMin(), fRange[2]->GetMax()); + UpdateAll(1); +} + +//_________________________________________________________________________ + void V0ListEditor::MassAntiLamRange() { + fMList->ALamMFilter(fRange[3]->GetMin(), fRange[3]->GetMax()); + UpdateAll(2); +} + +//_________________________________________________________________________ +void V0ListEditor::ESDv0IndexRange() { + fMList->IndexFilter(fRange[12]->GetMin(), fRange[12]->GetMax()); + UpdateAll(4); +} + +//_________________________________________________________________________ + void V0ListEditor::CosPointingRange() { + fMList->CosPointingFilter(fRange[5]->GetMin(), fRange[5]->GetMax()); + UpdateAll(5); +} + +//_________________________________________________________________________ + void V0ListEditor::DaughterDcaRange() { + fMList->DaughterDCAFilter(fRange[4]->GetMin(), fRange[4]->GetMax()); + UpdateAll(6); +} + +//_________________________________________________________________________ + void V0ListEditor::RadiusRange() { + fMList->RadiusFilter(fRange[6]->GetMin(), fRange[6]->GetMax()); + UpdateAll(7); +} + +//_________________________________________________________________________ +void V0ListEditor::PtRange() +{ + fMList->PtFilter(fRange[0]->GetMin(), fRange[0]->GetMax()); + UpdateAll(8); +} + +//_________________________________________________________________________ + void V0ListEditor::EtaRange() { + fMList->EtaFilter(fRange[7]->GetMin(), fRange[7]->GetMax()); + UpdateAll(9); +} + +//_________________________________________________________________________ + void V0ListEditor::NegPtRange() { + fMList->NegPtFilter(fRange[8]->GetMin(), fRange[8]->GetMax()); + UpdateAll(10); +} + +//_________________________________________________________________________ + void V0ListEditor::NegEtaRange() { + fMList->NegEtaFilter(fRange[9]->GetMin(), fRange[9]->GetMax()); + UpdateAll(11); +} + +//_________________________________________________________________________ + void V0ListEditor::PosPtRange() { + fMList->PosPtFilter(fRange[10]->GetMin(), fRange[10]->GetMax()); + UpdateAll(12); +} + +//_________________________________________________________________________ + void V0ListEditor::PosEtaRange() { + fMList->PosEtaFilter(fRange[11]->GetMin(), fRange[11]->GetMax()); + UpdateAll(12); +} + diff --git a/EVE/Reve/V0Editors.h b/EVE/Reve/V0Editors.h new file mode 100644 index 00000000000..3262ba18de5 --- /dev/null +++ b/EVE/Reve/V0Editors.h @@ -0,0 +1,102 @@ + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +/*********************************************************************** + This editor appears in the Reve window when v0 are visualize. +It allows to select the v0 as a function of some useful parameters. + +Ludovic Gaudichet (gaudichet@to.infn.it) +************************************************************************/ + + +#ifndef REVE_V0Editors_H +#define REVE_V0Editors_H + +#include + +class TGCheckButton; +class TGNumberEntry; +class TGColorSelect; +class TRootEmbeddedCanvas; +class TH1F; +class TGCompositeFrame; +class TGTab; + +namespace Reve { + +class RGValuator; +class RGDoubleValuator; + +class V0List; + +class V0ListEditor : public TGedFrame +{ + V0ListEditor(const V0ListEditor&); // Not implemented + V0ListEditor& operator=(const V0ListEditor&); // Not implemented + +protected: + V0List* fMList; // fModel dynamic-casted to V0ListEditor + + TGCheckButton* fRnrV0sDaugh; + TGCheckButton* fRnrV0vtx; + TGCheckButton* fRnrV0path; + + TGTab *fMainTabA; + TGTab *fMainTabB; + TGTab *fTabA[3]; + TGTab *fTabB[3]; + static const Int_t fgkNRange = 13; + RGDoubleValuator *fRange[fgkNRange]; + + static const Int_t fgkNCanvas = 14; + TRootEmbeddedCanvas *fCanvasA[fgkNCanvas]; + TRootEmbeddedCanvas *fCanvasB[fgkNCanvas]; + + TGCompositeFrame* AddTab(TGTab *tab, Int_t i, Int_t can, char *name); + TGCompositeFrame** CreateTab(TGTab **pMainTab, TGTab **ptab, Int_t can); + + void UpdateAll(Int_t iCanA); + void AddSelectTab(); + void AddSeeTab(); + void AddValuator(TGCompositeFrame* frame, char *name, + Float_t min, Float_t max, Int_t pres, char *func, + Int_t iHist); + + +public: + V0ListEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30, + UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground()); + ~V0ListEditor(); + + virtual void SetModel(TObject* obj); + void DoRnrDaughters(); + void DoRnrV0vtx(); + void DoRnrV0path(); + void FillCanvas(); + void UpdateSelectedTab(); + void AdjustHist(Int_t iHist); + void ResetCuts(); + + void MassK0sRange(); + void MassLamRange(); + void MassAntiLamRange(); + void ESDv0IndexRange(); + void CosPointingRange(); + void DaughterDcaRange(); + void RadiusRange(); + void PtRange(); + void EtaRange(); + void NegPtRange(); + void NegEtaRange(); + void PosPtRange(); + void PosEtaRange(); + + + ClassDef(V0ListEditor, 1); // Editor for V0List +}; // endclass V0ListEditor + +} + +#endif -- 2.43.0