--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
+
+/***********************************************************************
+* This code defines the reconstructed cascades visualized with EVE
+*
+* Ludovic Gaudichet (gaudichet@to.infn.it)
+************************************************************************/
+
+#include "Cascade.h"
+
+#include <Reve/Track.h>
+#include <Reve/MCHelixLine.hi>
+
+#include <TPolyLine3D.h>
+#include <TPolyMarker3D.h>
+#include <TColor.h>
+
+// Updates
+#include <Reve/ReveManager.h>
+#include <TCanvas.h>
+#include <TH1F.h>
+#include <TH2F.h>
+
+#include <vector>
+
+
+using namespace Reve;
+using namespace Alieve;
+
+
+/***********************************************************************
+*
+* Cascade class
+*
+************************************************************************/
+
+const Float_t Cascade::fgkMassPion2 = 0.13956995*0.13956995;
+const Float_t Cascade::fgkMassKaon2 = 0.493677*0.493677;
+const Float_t Cascade::fgkMassProton2 = 0.93827231*0.93827231;
+const Float_t Cascade::fgkMassLambda2 = 1.115683*1.115683;
+
+ClassImp(Alieve::Cascade)
+
+
+Cascade::Cascade() :
+ RenderElement(),
+ TPolyMarker3D(1),
+ fV_neg(),
+ fP_neg(),
+ fV_pos(),
+ fP_pos(),
+ fV_bach(),
+ fP_bach(),
+ fV_decay(),
+ fV_birth(),
+ fPathMarksNeg(),
+ fPathMarksPos(),
+ fPathMarksBach(),
+ fRnrStyle(0),
+ fPolyLineNeg(),
+ fPolyLinePos(),
+ fPolyLineBach(),
+ fPolyLineV0(),
+ fPolyLineCas(),
+ fBeta_neg(0),
+ fBeta_pos(0),
+ fBeta_bach(0),
+ fESDIndex(-1),
+ fDCA_v0_Bach(999),
+ fCasCosPointingAngle(999),
+ fCasDecayLength(999)
+{
+ fPolyLinePos.SetLineColor(2); // red
+ fPolyLineNeg.SetLineColor(7); // light blue
+ fPolyLineBach.SetLineColor(4); // blue
+
+ fMarkerStyle = 20;
+ fMarkerColor = 5;
+ fMarkerSize = 0.3;
+}
+
+
+
+Cascade::Cascade(TrackRnrStyle* rs) :
+ RenderElement(),
+ TPolyMarker3D(1),
+ fV_neg(),
+ fP_neg(),
+ fV_pos(),
+ fP_pos(),
+ fV_bach(),
+ fP_bach(),
+ fV_decay(),
+ fV_birth(),
+ fPathMarksNeg(),
+ fPathMarksPos(),
+ fPathMarksBach(),
+ fRnrStyle(rs),
+ fPolyLineNeg(),
+ fPolyLinePos(),
+ fPolyLineBach(),
+ fPolyLineV0(),
+ fPolyLineCas(),
+ fBeta_neg(0),
+ fBeta_pos(0),
+ fBeta_bach(0),
+ fESDIndex(-1),
+ fDCA_v0_Bach(999),
+ fCasCosPointingAngle(999),
+ fCasDecayLength(999)
+{
+ fMarkerColor = fRnrStyle->fFVAtt.GetMarkerColor();
+ fPolyLineV0.SetLineColor(fMarkerColor);
+ fPolyLinePos.SetLineColor(2); // red
+ fPolyLineNeg.SetLineColor(7); // light blue
+ fPolyLineBach.SetLineColor(4); // blue
+
+ fMainColorPtr = &fMarkerColor;
+ fMarkerStyle = 20;
+ fMarkerColor = 5;
+ fMarkerSize = 0.3;
+}
+
+
+Cascade::~Cascade()
+{
+ for (vpPathMark_i i=fPathMarksNeg.begin(); i!=fPathMarksNeg.end(); ++i)
+ delete *i;
+ for (vpPathMark_i i=fPathMarksPos.begin(); i!=fPathMarksPos.end(); ++i)
+ delete *i;
+ for (vpPathMark_i i=fPathMarksBach.begin(); i!=fPathMarksBach.end(); ++i)
+ delete *i;
+}
+void Cascade::Reset(TPolyLine3D* polyLine) {
+ //polyLine->SetPolyLine(n_points);
+ polyLine->SetPolyLine(0);
+}
+
+
+//______________________________________________________________________
+void Cascade::SetDecayLength(Float_t primx, Float_t primy, Float_t primz) {
+
+
+ Float_t dx = fV_decay.x-primx;
+ Float_t dy = fV_decay.y-primy;
+ Float_t dz = fV_decay.z-primz;
+
+ fCasDecayLength = sqrt(dx*dx+dy*dy+dz*dz);
+ // This is probably wrong but I can only do this for now
+ Float_t distNorm = fCasDecayLength/GetMomentum();
+ fV_birth.x = fV_decay.x - distNorm*GetPx();
+ fV_birth.y = fV_decay.y - distNorm*GetPy();
+ fV_birth.z = fV_decay.z - distNorm*GetPz();
+
+ fV_bach.x = fV_decay.x;
+ fV_bach.y = fV_decay.y;
+ fV_bach.z = fV_decay.z;
+}
+
+
+//______________________________________________________________________
+void Cascade::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<MCVertex> 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<Reve::PathMark*>::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<Reve::PathMark*>::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<MCVertex>::iterator i=track_points.begin();
+ i!=track_points.end(); ++i) {
+ polyLine.SetNextPoint(i->x,i->y, i->z);
+ }
+
+}
+
+//______________________________________________________________________
+void Cascade::MakeV0path() {
+
+ MCVertex mc_v0;
+ mc_v0.x = (fV_neg.x+fV_pos.x)/2;
+ mc_v0.y = (fV_neg.y+fV_pos.y)/2;
+ mc_v0.z = (fV_neg.z+fV_pos.z)/2;
+ mc_v0.t = 0;
+
+ std::vector<MCVertex> track_points;
+ MCLine line(fRnrStyle, &mc_v0, TMath::C()*0.99, &track_points);
+
+ line.GotoVertex(fV_decay.x,fV_decay.y,fV_decay.z);
+
+ Reset(&fPolyLineV0);
+ for(std::vector<MCVertex>::iterator i=track_points.begin();
+ i!=track_points.end(); ++i) {
+ fPolyLineV0.SetNextPoint(i->x,i->y, i->z);
+ }
+
+}
+
+//______________________________________________________________________
+void Cascade::MakeCasPath() {
+
+ MCVertex mc_v0;
+ mc_v0.x = fV_birth.x;
+ mc_v0.y = fV_birth.y;
+ mc_v0.z = fV_birth.z;
+ mc_v0.t = 0;
+
+ std::vector<MCVertex> track_points;
+ MCLine line(fRnrStyle, &mc_v0, TMath::C()*0.99, &track_points);
+
+ line.GotoVertex(fV_decay.x,fV_decay.y,fV_decay.z);
+
+ Reset(&fPolyLineCas);
+ for(std::vector<MCVertex>::iterator i=track_points.begin();
+ i!=track_points.end(); ++i) {
+ fPolyLineCas.SetNextPoint(i->x,i->y, i->z);
+ }
+}
+
+
+//______________________________________________________________________
+void Cascade::MakeCascade()
+{
+ SetNextPoint(fV_neg.x, fV_neg.y, fV_neg.z);
+ SetNextPoint(fV_decay.x, fV_decay.y, fV_decay.z);
+
+ MakeTrack(fPathMarksNeg, fV_neg, fP_neg, -1, fBeta_neg, fPolyLineNeg);
+ MakeTrack(fPathMarksPos, fV_pos, fP_pos, 1, fBeta_pos, fPolyLinePos);
+ if (fBeta_bach>0)
+ MakeTrack(fPathMarksBach, fV_bach, fP_bach, 1, fBeta_bach, fPolyLineBach);
+ else
+ MakeTrack(fPathMarksBach, fV_bach, fP_bach, -1, -fBeta_bach, fPolyLineBach);
+ MakeV0path();
+ MakeCasPath();
+}
+
+
+
+
+//______________________________________________________________________
+Float_t Cascade::GetCasAlphaArmenteros() const
+{
+ Float_t px = GetPx(), py = GetPy(), pz = GetPz();
+ Float_t posXcas, negXcas;
+
+ if (fBeta_bach>0) {
+ posXcas = fP_bach.x*px + fP_bach.y*py + fP_bach.z*pz;
+ negXcas = (fP_neg.x+fP_pos.x)*px + (fP_neg.y+fP_pos.y)*py + (fP_neg.z+fP_pos.z)*pz;
+ } else {
+ posXcas = (fP_neg.x+fP_pos.x)*px + (fP_neg.y+fP_pos.y)*py + (fP_neg.z+fP_pos.z)*pz;
+ negXcas = fP_bach.x*px + fP_bach.y*py + fP_bach.z*pz;
+ }
+
+ if (posXcas + negXcas > 1.e-39)
+ return (posXcas - negXcas)/(posXcas + negXcas);
+ else return -999;
+}
+
+
+//______________________________________________________________________
+Float_t Cascade::GetCasPtArmenteros() const
+{
+ Float_t px = GetPx(), py = GetPy(), pz = GetPz();
+ Float_t p2 = px*px + py*py + pz*pz;
+ if (p2 < 1.e-39) return -999;
+
+ Float_t posXcas, posP2;
+
+ if (fBeta_bach>0) {
+ posXcas = fP_bach.x*px + fP_bach.y*py + fP_bach.z*pz;
+ posP2 = GetBachP2();
+ } else {
+ posXcas = (fP_neg.x+fP_pos.x)*px + (fP_neg.y+fP_pos.y)*py + (fP_neg.z+fP_pos.z)*pz;
+ posP2 = GetV0P2();
+ }
+ return sqrt( posP2 - posXcas*posXcas/p2 );
+}
+
+
+
+/***********************************************************************
+*
+* CascadeList class
+*
+************************************************************************/
+
+ClassImp(Alieve::CascadeList)
+
+
+//______________________________________________________________________
+CascadeList::CascadeList(TrackRnrStyle* rs) :
+ RenderElementList(),
+ fTitle(),
+ fRnrStyle(rs),
+ fRnrBach(kTRUE),
+ fRnrV0Daughters(kTRUE),
+ fRnrV0vtx(kTRUE),
+ fRnrV0path(kTRUE),
+ fRnrCasVtx(kTRUE),
+ fRnrCasPath(kTRUE),
+ fNegColor(0),
+ fPosColor(0),
+ fBachColor(0)
+{
+ fChildClass = Cascade::Class(); // override member from base RenderElementList
+
+ Init();
+}
+
+
+//______________________________________________________________________
+CascadeList::CascadeList(const Text_t* name, TrackRnrStyle* rs) :
+ RenderElementList(),
+ fTitle(),
+ fRnrStyle(rs),
+ fRnrBach(kTRUE),
+ fRnrV0Daughters(kTRUE),
+ fRnrV0vtx(kTRUE),
+ fRnrV0path(kTRUE),
+ fRnrCasVtx(kTRUE),
+ fRnrCasPath(kTRUE),
+ fNegColor(0),
+ fPosColor(0),
+ fBachColor(0)
+{
+ fChildClass = Cascade::Class(); // override member from base RenderElementList
+
+ Init();
+ SetName(name);
+}
+
+
+//______________________________________________________________________
+void CascadeList::Init()
+{
+ if (fRnrStyle== 0) fRnrStyle = new TrackRnrStyle;
+
+ fMin[0] = 0; fMax[0] = 5; // Xi mass
+ fMin[1] = 0; fMax[1] = 5; // Omega mass
+ fMin[2] = 0; fMax[2] = 1e5; // Index
+ fMin[3] = 0.8; fMax[3] = 1; // cosPointingAngle
+ fMin[4] = 0; fMax[4] = 5; // bachV0DCA
+ fMin[5] = 0; fMax[5] = 100; // radius
+ fMin[6] = 0; fMax[6] = 10; // Pt
+ fMin[7] = -2; fMax[7] = 2; // PseudoRapidity
+ fMin[8] = 0; fMax[8] = 10; // negPt
+ fMin[9] = -2; fMax[9] = 2; // negEta
+ fMin[10] = 0; fMax[10] = 10; // posPt
+ fMin[11] = -2; fMax[11] = 2; // posEta
+ fMin[12] = 0; fMax[12] = 10; // bachPt
+ fMin[13] = -2; fMax[13] = 2; // backEta
+
+ char *ch = "XiMass";
+ fHist[0] = new TH1F(ch,ch, 100, fMin[0], fMax[0]);
+ ch = "OmegaMass";
+ fHist[1] = new TH1F(ch,ch, 100, fMin[1], fMax[1]);
+ ch = "Index";
+ fHist[2] = new TH1F(ch,ch, 100, fMin[2], fMax[2]);
+
+ ch = "cosPointingAngle";
+ fHist[3] = new TH1F(ch,ch, 100, fMin[3], fMax[3]);
+ ch = "bachV0DCA";
+ fHist[4] = new TH1F(ch,ch, 100, fMin[4], fMax[4]);
+ ch = "radius";
+ fHist[5] = new TH1F(ch,ch, 100, fMin[5], fMax[5]);
+ ch = "Pt";
+ 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 = "negEta";
+ 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 = "posEta";
+ fHist[11] = new TH1F(ch,ch, 100, fMin[11], fMax[11]);
+ ch = "bachPt";
+ fHist[12] = new TH1F(ch,ch, 100, fMin[12], fMax[12]);
+ ch = "backEta";
+ fHist[13] = new TH1F(ch,ch, 100, fMin[13], fMax[13]);
+
+ 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; i<fgkNcutVar; i++) {
+ fHist[i]->GetXaxis()->SetLabelSize(0.07);
+ fHist[i]->GetYaxis()->SetLabelSize(0.07);
+ fHist[i]->SetStats(0);
+ }
+ for (Int_t i=0; i<fgkNcutVar2D; i++) {
+ fHist2D[i]->GetXaxis()->SetLabelSize(0.07);
+ fHist2D[i]->GetYaxis()->SetLabelSize(0.07);
+ fHist2D[i]->SetStats(0);
+ }
+}
+
+
+//______________________________________________________________________
+void CascadeList::Paint(Option_t* option) {
+ if(fRnrSelf) {
+
+ if(fRnrBach) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ if((*i)->GetRnrSelf()) {
+ ((Cascade*)(*i))->PaintBachelor(option);
+ }
+ }
+ }
+
+ if(fRnrV0Daughters) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ if((*i)->GetRnrSelf()) {
+ ((Cascade*)(*i))->PaintV0Daughters(option);
+ }
+ }
+ }
+
+ if(fRnrV0path) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ if((*i)->GetRnrSelf()) {
+ ((Cascade*)(*i))->PaintV0Path(option);
+ }
+ }
+ }
+
+ if(fRnrCasVtx) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ if((*i)->GetRnrSelf()) {
+ ((Cascade*)(*i))->Paint(option);
+ }
+ }
+ }
+
+ if(fRnrCasPath) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ if((*i)->GetRnrSelf()) {
+ ((Cascade*)(*i))->PaintCasPath(option);
+ }
+ }
+ }
+
+ } // end if(fRnrSelf)
+}
+
+
+//______________________________________________________________________
+void CascadeList::SetRnrV0vtx(Bool_t rnr)
+{
+ fRnrV0vtx = rnr;
+ gReve->Redraw3D();
+}
+
+void CascadeList::SetRnrV0path(Bool_t rnr)
+{
+ fRnrV0path = rnr;
+ gReve->Redraw3D();
+}
+
+void CascadeList::SetRnrV0Daughters(Bool_t rnr)
+{
+ fRnrV0Daughters = rnr;
+ gReve->Redraw3D();
+}
+
+
+void CascadeList::SetRnrCasPath(Bool_t rnr)
+{
+ fRnrCasPath = rnr;
+ gReve->Redraw3D();
+}
+
+void CascadeList::SetRnrCasVtx(Bool_t rnr)
+{
+ fRnrCasVtx = rnr;
+ gReve->Redraw3D();
+}
+
+void CascadeList::SetRnrBachelor(Bool_t rnr)
+{
+ fRnrBach = rnr;
+ gReve->Redraw3D();
+}
+
+
+//______________________________________________________________________
+
+void CascadeList::MakeCascades()
+{
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ ((Cascade*)(*i))->MakeCascade();
+ }
+ gReve->Redraw3D();
+}
+
+//_________________________________________________________________________
+void CascadeList::AdjustHist(Int_t iHist) {
+
+ if ((iHist<0)||(iHist>=fgkNcutVar)) return;
+ 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 CascadeList::UnFill(Cascade* cas) {
+
+
+ Int_t bin = fHist[0]->GetXaxis()->FindBin(cas->GetXiMass());
+ fHist[0]->SetBinContent( bin, fHist[0]->GetBinContent(bin)-1 );
+
+ bin = fHist[1]->GetXaxis()->FindBin( cas->GetOmegaMass() );
+ fHist[1]->SetBinContent( bin, fHist[1]->GetBinContent(bin)-1 );
+
+
+ bin = fHist[2]->GetXaxis()->FindBin( cas->GetESDIndex() );
+ fHist[2]->SetBinContent( bin, fHist[2]->GetBinContent(bin)-1 );
+
+ bin = fHist[3]->GetXaxis()->FindBin( cas->GetCasCosPointingAngle() );
+ fHist[3]->SetBinContent( bin, fHist[3]->GetBinContent(bin)-1 );
+
+ bin = fHist[4]->GetXaxis()->FindBin( cas->GetDCA_v0_Bach() );
+ fHist[4]->SetBinContent( bin, fHist[4]->GetBinContent(bin)-1 );
+
+ bin = fHist[5]->GetXaxis()->FindBin( cas->GetRadius() );
+ fHist[5]->SetBinContent( bin, fHist[5]->GetBinContent(bin)-1 );
+
+ bin = fHist[6]->GetXaxis()->FindBin( cas->GetPt() );
+ fHist[6]->SetBinContent( bin, fHist[6]->GetBinContent(bin)-1 );
+
+ bin = fHist[7]->GetXaxis()->FindBin( cas->GetPseudoRapidity() );
+ fHist[7]->SetBinContent( bin, fHist[7]->GetBinContent(bin)-1 );
+ //---
+
+ bin = fHist[8]->GetXaxis()->FindBin( cas->GetNegPt() );
+ fHist[8]->SetBinContent( bin, fHist[8]->GetBinContent(bin)-1 );
+
+ bin = fHist[9]->GetXaxis()->FindBin( cas->GetNegPseudoRapidity() );
+ fHist[9]->SetBinContent( bin, fHist[9]->GetBinContent(bin)-1 );
+
+ bin = fHist[10]->GetXaxis()->FindBin( cas->GetPosPt() );
+ fHist[10]->SetBinContent( bin, fHist[10]->GetBinContent(bin)-1 );
+
+ bin = fHist[11]->GetXaxis()->FindBin( cas->GetPosPseudoRapidity() );
+ fHist[11]->SetBinContent( bin, fHist[11]->GetBinContent(bin)-1 );
+
+ bin = fHist[12]->GetXaxis()->FindBin( cas->GetBachPt() );
+ fHist[12]->SetBinContent( bin, fHist[12]->GetBinContent(bin)-1 );
+
+ bin = fHist[13]->GetXaxis()->FindBin( cas->GetBachPseudoRapidity() );
+ fHist[13]->SetBinContent( bin, fHist[13]->GetBinContent(bin)-1 );
+
+ //---
+ bin = fHist2D[0]->GetXaxis()->FindBin( cas->GetCasAlphaArmenteros() );
+ Int_t binY = fHist2D[0]->GetYaxis()->FindBin( cas->GetCasPtArmenteros() );
+ fHist2D[0]->SetBinContent( bin, binY, fHist2D[0]->GetBinContent(bin,binY)-1 );
+}
+
+
+//______________________________________________________________________
+void CascadeList::Filter(Cascade* cas) {
+
+ Float_t xiMass = cas->GetXiMass();
+ if ((xiMass<fMin[0])||(xiMass>fMax[0])) return;
+
+ Float_t omegaMass = cas->GetOmegaMass();
+ if ( (omegaMass<fMin[1])||(omegaMass>fMax[1]) ) return;
+
+
+ Float_t index = cas->GetESDIndex();
+ if ( (index<fMin[2])||(index>fMax[2]) ) return;
+
+ Float_t cosPointingAngle = cas->GetCasCosPointingAngle();
+ if ( (cosPointingAngle<fMin[3])||(cosPointingAngle>fMax[3]) ) return;
+
+ Float_t bachV0DCA = cas->GetDCA_v0_Bach();
+ if ( (bachV0DCA<fMin[4])||(bachV0DCA>fMax[4]) ) return;
+
+ Float_t radius = cas->GetRadius();
+ if ( (radius<fMin[5])||(radius>fMax[5]) ) return;
+
+ Float_t pt = cas->GetPt();
+ if ( (pt<fMin[6])||(pt>fMax[6]) ) return;
+
+ Float_t pseudoRapidity = cas->GetPseudoRapidity();
+ if ( (pseudoRapidity<fMin[7])||(pseudoRapidity>fMax[7]) ) return;
+
+ Float_t negPt = cas->GetNegPt();
+ if ( (negPt<fMin[8])||(negPt>fMax[8]) ) return;
+
+ Float_t negEta = cas->GetNegPseudoRapidity();
+ if ( (negEta<fMin[9])||(negEta>fMax[9]) ) return;
+
+ Float_t posPt = cas->GetPosPt();
+ if ( (posPt<fMin[10])||(posPt>fMax[10]) ) return;
+
+ Float_t posEta = cas->GetPosPseudoRapidity();
+ if ( (posEta<fMin[11])||(posEta>fMax[11]) ) return;
+
+ Float_t bachPt = cas->GetBachPt();
+ if ( (bachPt<fMin[12])||(bachPt>fMax[12]) ) return;
+
+ Float_t bachEta = cas->GetBachPseudoRapidity();
+ if ( (bachEta<fMin[13])||(bachEta>fMax[13]) ) return;
+
+ cas->SetRnrSelf(kTRUE);
+ fHist[0]->Fill(xiMass);
+ fHist[1]->Fill(omegaMass);
+ fHist[2]->Fill(index);
+ fHist[3]->Fill(cosPointingAngle);
+ fHist[4]->Fill(bachV0DCA);
+ fHist[5]->Fill(radius);
+ fHist[6]->Fill(pt);
+ fHist[7]->Fill(pseudoRapidity);
+ fHist[8]->Fill(negPt);
+ fHist[9]->Fill(negEta);
+ fHist[10]->Fill(posPt);
+ fHist[11]->Fill(posEta);
+ fHist[12]->Fill(bachPt);
+ fHist[13]->Fill(bachEta);
+
+ fHist2D[0]->Fill(cas->GetCasAlphaArmenteros(), cas->GetCasPtArmenteros() );
+}
+
+//______________________________________________________________________
+void CascadeList::FilterAll() {
+
+ for (Int_t i=0; i<fgkNcutVar; i++)
+ fHist[i]->Reset();
+
+ for (Int_t i=0; i<fgkNcutVar2D; i++)
+ fHist2D[i]->Reset();
+
+ Cascade* myCas;
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ Filter(myCas);
+ }
+}
+
+
+//______________________________________________________________________
+void CascadeList::GetCasIndexRange(Int_t &imin, Int_t &imax) {
+
+ Int_t index;
+ Cascade* myCas;
+ List_i i = fChildren.begin();
+ myCas = (Cascade*)(*i);
+ index = myCas->GetESDIndex();
+ imin = index;
+ imax = index;
+
+ for(; i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ index = myCas->GetESDIndex();
+ if (index<imin) imin = index;
+ if (index>imax) imax = index;
+ }
+}
+
+//______________________________________________________________________
+void CascadeList::XiMassFilter(Float_t min, Float_t max) {
+
+ fMin[0] = min;
+ fMax[0] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetXiMass();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+//______________________________________________________________________
+void CascadeList::OmegaMassFilter(Float_t min, Float_t max) {
+
+ fMin[1] = min;
+ fMax[1] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetOmegaMass();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+//______________________________________________________________________
+void CascadeList::IndexFilter(Float_t min, Float_t max) {
+
+ fMin[2] = min;
+ fMax[2] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetESDIndex();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+//______________________________________________________________________
+void CascadeList::CosPointingFilter(Float_t min, Float_t max) {
+
+ fMin[3] = min;
+ fMax[3] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetCasCosPointingAngle();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+
+//______________________________________________________________________
+void CascadeList::BachV0DCAFilter(Float_t min, Float_t max) {
+
+ fMin[4] = min;
+ fMax[4] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetDCA_v0_Bach();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+
+//______________________________________________________________________
+void CascadeList::RadiusFilter(Float_t min, Float_t max) {
+
+ fMin[5] = min;
+ fMax[5] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetRadius();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+
+//______________________________________________________________________
+void CascadeList::PtFilter(Float_t min, Float_t max) {
+
+ fMin[6] = min;
+ fMax[6] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetPt();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+
+//______________________________________________________________________
+void CascadeList::PseudoRapFilter(Float_t min, Float_t max) {
+
+ fMin[7] = min;
+ fMax[7] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetPseudoRapidity();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+
+//______________________________________________________________________
+void CascadeList::NegPtFilter(Float_t min, Float_t max) {
+
+ fMin[8] = min;
+ fMax[8] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetNegPt();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+
+//______________________________________________________________________
+void CascadeList::NegEtaFilter(Float_t min, Float_t max) {
+
+ fMin[9] = min;
+ fMax[9] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetNegPseudoRapidity();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+
+//______________________________________________________________________
+void CascadeList::PosPtFilter(Float_t min, Float_t max) {
+
+ fMin[10] = min;
+ fMax[10] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetPosPt();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+//______________________________________________________________________
+void CascadeList::PosEtaFilter(Float_t min, Float_t max) {
+
+ fMin[11] = min;
+ fMax[11] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetPosPseudoRapidity();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+
+//______________________________________________________________________
+void CascadeList::BachPtFilter(Float_t min, Float_t max) {
+
+ fMin[12] = min;
+ fMax[12] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetBachPt();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
+//______________________________________________________________________
+void CascadeList::BachEtaFilter(Float_t min, Float_t max) {
+
+ fMin[13] = min;
+ fMax[13] = max;
+
+ Float_t val;
+ Bool_t wasSelected;
+ Bool_t isSelected;
+ Cascade* myCas;
+
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myCas = (Cascade*)(*i);
+ val = myCas->GetBachPseudoRapidity();
+ wasSelected = myCas->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myCas);
+ myCas->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myCas);
+ }
+ }
+}
+
--- /dev/null
+#ifndef ALIEVE_CASCADE_H
+#define ALIEVE_CASCADE_H
+
+/***********************************************************************
+* This code defines the reconstructed cascades visualized with EVE
+*
+* Ludovic Gaudichet (gaudichet@to.infn.it)
+************************************************************************/
+
+#include <Reve/PODs.h>
+#include <Reve/RenderElement.h>
+#include <Reve/Track.h>
+
+#include <TPolyMarker3D.h>
+#include <TPolyLine3D.h>
+
+class TH1F;
+class TH2F;
+
+
+namespace Alieve {
+
+class CascadeList;
+
+class Cascade : public Reve::RenderElement,
+ public TPolyMarker3D
+{
+public:
+ typedef std::vector<Reve::PathMark*> vpPathMark_t;
+
+private:
+ friend class CascadeList;
+
+ Cascade(const Cascade&); // Not implemented
+ Cascade& operator=(const Cascade&); // Not implemented
+
+protected:
+ typedef std::vector<Reve::PathMark*>::iterator vpPathMark_i;
+
+ 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_bach; // Vertex of positive track
+ Reve::Vector fP_bach; // Momentum of positive track
+
+ Reve::Vector fV_decay; //decay point of the cascade
+ Reve::Vector fV_birth; // Reconstructed birth point of neutral particle
+
+ vpPathMark_t fPathMarksNeg;
+ vpPathMark_t fPathMarksPos;
+ vpPathMark_t fPathMarksBach;
+ Reve::TrackRnrStyle *fRnrStyle;
+
+ TPolyLine3D fPolyLineNeg;
+ TPolyLine3D fPolyLinePos;
+ TPolyLine3D fPolyLineBach;
+ TPolyLine3D fPolyLineV0; // line of V0 travel
+ TPolyLine3D fPolyLineCas; // line of cascade travel
+
+ Float_t fBeta_neg;
+ Float_t fBeta_pos;
+ Float_t fBeta_bach;
+
+ Int_t fESDIndex;
+
+ Float_t fDCA_v0_Bach;
+ Float_t fCasCosPointingAngle;
+ Float_t fCasDecayLength;
+
+ static const Float_t fgkMassPion2;
+ static const Float_t fgkMassKaon2;
+ static const Float_t fgkMassProton2;
+ static const Float_t fgkMassLambda2;
+
+public:
+ Cascade();
+ Cascade(Reve::TrackRnrStyle* rs);
+ virtual ~Cascade();
+
+ virtual void SetESDIndex(Int_t ind) { fESDIndex = ind;}
+ virtual void SetMainColor(Color_t col)
+ {
+ fMarkerColor = col; fMainColorPtr = &fMarkerColor;
+ fPolyLineV0.SetLineColor(fMarkerColor);
+ }
+ virtual void SetTracksColor(Color_t cNeg, Color_t cPos, Color_t cBach)
+ {
+ fPolyLineNeg.SetLineColor(cNeg); fPolyLinePos.SetLineColor(cPos);
+ fPolyLineBach.SetLineColor(cBach);
+ }
+ void SetRnrStyle(Reve::TrackRnrStyle* rs) { fRnrStyle = rs; }
+
+ void AddPathMarkPos(Reve::PathMark* pm) { fPathMarksPos.push_back(pm); }
+ void AddPathMarkNeg(Reve::PathMark* pm) { fPathMarksNeg.push_back(pm); }
+ void AddPathMarkBach(Reve::PathMark* pm) { fPathMarksBach.push_back(pm); }
+
+ virtual void PaintV0Daughters(Option_t* option="") {
+ if(fRnrSelf) {fPolyLineNeg.Paint(option);fPolyLinePos.Paint(option); } }
+ virtual void PaintBachelor(Option_t* option="") {
+ if(fRnrSelf) fPolyLineBach.Paint(option); }
+ virtual void Paint(Option_t* option="") {
+ if(fRnrSelf) TPolyMarker3D::Paint(option);}
+ virtual void PaintV0Path(Option_t* option="") {
+ if(fRnrSelf) fPolyLineV0.Paint(option);}
+ virtual void PaintCasPath(Option_t* option="") {
+ if(fRnrSelf) fPolyLineCas.Paint(option);}
+
+ 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 MakeCasPath();
+ void MakeCascade();
+
+ void SetBeta(Float_t betaNeg, Float_t betaPos, Float_t betaBach);
+ void SetDCA_v0_Bach(Float_t dca) {fDCA_v0_Bach = dca;}
+ void SetCasCosPointingAngle(Float_t cos) {fCasCosPointingAngle = cos;}
+ void SetNegP(Float_t px, Float_t py, Float_t pz) {fP_neg.x = px; fP_neg.y = py; fP_neg.z = pz;}
+ void SetPosP(Float_t px, Float_t py, Float_t pz) {fP_pos.x = px; fP_pos.y = py; fP_pos.z = pz;}
+ void SetBachP(Float_t px, Float_t py, Float_t pz) {fP_bach.x = px; fP_bach.y = py; fP_bach.z = pz;}
+
+ void SetV0vtx(Float_t vx, Float_t vy, Float_t vz) {
+ fV_neg.x = vx; fV_neg.y = vy; fV_neg.z = vz;
+ fV_pos.x = vx; fV_pos.y = vy; fV_pos.z = vz;
+ }
+ void SetCascadeVtx(Float_t vx, Float_t vy, Float_t vz) {
+ fV_decay.x = vx; fV_decay.y = vy; fV_decay.z = vz; }
+
+ void SetDecayLength(Float_t primx, Float_t primy, Float_t primz);
+
+ Int_t GetESDIndex() const { return fESDIndex; }
+ virtual const Text_t* GetName() const { return Form("ESDcascade_%i",fESDIndex); }
+ virtual const Text_t* GetTitle() const { return Form("ESDcascade_%i",fESDIndex); }
+
+ Float_t GetDCA_v0_Bach() const;
+ Float_t GetCasCosPointingAngle() const;
+ Float_t GetRadius() const;
+ Float_t GetPseudoRapidity() const;
+ Float_t GetPt2() const;
+ Float_t GetPt() const;
+ Float_t GetP2() const;
+ Float_t GetMomentum() const;
+ Float_t GetPx() const;
+ Float_t GetPy() const;
+ Float_t GetPz() const;
+ Float_t GetCasAlphaArmenteros() const;
+ Float_t GetCasPtArmenteros() const;
+ Float_t GetPosP2() const;
+ Float_t GetPosP() const;
+ Float_t GetPosPt() const;
+ Float_t GetPosPseudoRapidity() const;
+ Float_t GetNegP2() const;
+ Float_t GetNegP() const;
+ Float_t GetNegPt() const;
+ Float_t GetNegPseudoRapidity() const;
+ Float_t GetBachP2() const;
+ Float_t GetBachP() const;
+ Float_t GetBachPt() const;
+ Float_t GetBachPseudoRapidity() const;
+
+ Float_t GetV0P2() const;
+ Float_t GetLambdaE() const;
+ Float_t GetXiE() const;
+ Float_t GetOmegaE() const;
+ Float_t GetXiMass() const;
+ Float_t GetAntiXiMass() const;
+ Float_t GetOmegaMass() const;
+ Float_t GetAntiOmegaMass() const;
+
+ ClassDef(Cascade, 1); // Visual representation of a cascade.
+}; // endclass Cascade
+
+
+
+//______________________________________________________________________
+
+inline void Cascade::SetBeta(Float_t betaNeg, Float_t betaPos, Float_t betaBach) {
+ fBeta_neg = betaNeg;
+ fBeta_pos = betaPos;
+ fBeta_bach = betaBach;
+ }
+
+
+//______________________________________________________________________
+
+inline Float_t Cascade::GetV0P2() const {
+ 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 Cascade::GetLambdaE() const {
+ return sqrt(fgkMassLambda2+GetV0P2());
+}
+
+inline Float_t Cascade::GetXiE() const {
+ Float_t e = GetLambdaE() +
+ sqrt(fgkMassPion2 + fP_bach.x*fP_bach.x + fP_bach.y*fP_bach.y +
+ fP_bach.z*fP_bach.z);
+ return e;
+}
+
+inline Float_t Cascade::GetOmegaE() const {
+ Float_t e = GetLambdaE() +
+ sqrt(fgkMassKaon2 + fP_bach.x*fP_bach.x + fP_bach.y*fP_bach.y +
+ fP_bach.z*fP_bach.z);
+ return e;
+}
+
+inline Float_t Cascade::GetXiMass() const {
+ Float_t e = GetXiE();
+ return sqrt(e*e - GetP2());
+}
+
+inline Float_t Cascade::GetAntiXiMass() const { return GetXiMass();}
+
+inline Float_t Cascade::GetOmegaMass() const {
+ Float_t e = GetOmegaE();
+ return sqrt(e*e - GetP2());
+}
+
+inline Float_t Cascade::GetAntiOmegaMass() const { return GetOmegaMass();}
+
+
+//______________________________________________________________________
+
+inline Float_t Cascade::GetDCA_v0_Bach() const {
+ return fDCA_v0_Bach;
+}
+
+inline Float_t Cascade::GetCasCosPointingAngle() const {
+return fCasCosPointingAngle;
+}
+
+inline Float_t Cascade::GetRadius() const {
+ return sqrt(fV_birth.x*fV_birth.x + fV_birth.y*fV_birth.y);
+}
+
+//inline Float_t Cascade::GetDecayLength() const {
+//return fDecayLength;
+//}
+
+inline Float_t Cascade::GetPseudoRapidity() const {
+ Float_t theta = acos( GetPz()/GetMomentum() );
+ return ( -log(tan(theta/2.)) );
+}
+
+
+//______________________________________________________________________
+inline Float_t Cascade::GetPt2() const {
+ Float_t px = GetPx(), py = GetPy();
+ return (px*px+py*py);
+}
+
+inline Float_t Cascade::GetP2() const {
+
+ Float_t px = GetPx(), py = GetPy(), pz = GetPz();
+ return (px*px+py*py+pz*pz);
+}
+
+inline Float_t Cascade::GetPt() const {
+ return sqrt(GetPt2());
+}
+
+inline Float_t Cascade::GetMomentum() const {
+ return sqrt(GetP2());
+}
+
+inline Float_t Cascade::GetPx() const {
+ return (fP_neg.x + fP_pos.x + fP_bach.x);
+}
+
+inline Float_t Cascade::GetPy() const {
+ return (fP_neg.y + fP_pos.y + fP_bach.y);
+}
+
+inline Float_t Cascade::GetPz() const {
+ return (fP_neg.z + fP_pos.z + fP_bach.z);
+}
+
+//______________________________________________________________________
+
+inline Float_t Cascade::GetPosP2() const {
+ return (fP_pos.x*fP_pos.x + fP_pos.y*fP_pos.y + fP_pos.z*fP_pos.z);
+}
+
+inline Float_t Cascade::GetPosP() const {
+ return sqrt(GetPosP2());
+}
+
+inline Float_t Cascade::GetPosPt() const {
+ return sqrt(fP_pos.x*fP_pos.x + fP_pos.y*fP_pos.y);
+}
+
+inline Float_t Cascade::GetPosPseudoRapidity() const {
+ Float_t theta = acos( fP_pos.z/GetPosP() );
+ return ( -log(tan(theta/2.)) );
+}
+
+//______________________________________________________________________
+inline Float_t Cascade::GetNegP2() const {
+ return (fP_neg.x*fP_neg.x + fP_neg.y*fP_neg.y + fP_neg.z*fP_neg.z);
+}
+
+inline Float_t Cascade::GetNegP() const {
+ return sqrt(GetNegP2());
+}
+
+inline Float_t Cascade::GetNegPt() const {
+ return sqrt(fP_neg.x*fP_neg.x + fP_neg.y*fP_neg.y);
+}
+
+inline Float_t Cascade::GetNegPseudoRapidity() const {
+ Float_t theta = acos( fP_neg.z/GetNegP() );
+ return ( -log(tan(theta/2.)) );
+}
+
+
+//______________________________________________________________________
+inline Float_t Cascade::GetBachP2() const {
+ return (fP_bach.x*fP_bach.x + fP_bach.y*fP_bach.y + fP_bach.z*fP_bach.z);
+}
+
+inline Float_t Cascade::GetBachP() const {
+ return sqrt(GetBachP2());
+}
+
+inline Float_t Cascade::GetBachPt() const {
+ return sqrt(fP_bach.x*fP_bach.x + fP_bach.y*fP_bach.y);
+}
+
+inline Float_t Cascade::GetBachPseudoRapidity() const {
+ Float_t theta = acos( fP_bach.z/GetBachP() );
+ return ( -log(tan(theta/2.)) );
+}
+
+
+/***********************************************************************
+*
+* CascadeList class
+*
+************************************************************************/
+
+class CascadeList : public Reve::RenderElementList
+{
+ CascadeList(const CascadeList&); // Not implemented
+ CascadeList& operator=(const CascadeList&); // Not implemented
+
+private:
+ void Init();
+
+protected:
+ TString fTitle;
+
+ Reve::TrackRnrStyle *fRnrStyle;
+
+ Bool_t fRnrBach;
+ Bool_t fRnrV0Daughters;
+ Bool_t fRnrV0vtx;
+ Bool_t fRnrV0path;
+ Bool_t fRnrCasVtx;
+ Bool_t fRnrCasPath;
+
+ Color_t fNegColor;
+ Color_t fPosColor;
+ Color_t fBachColor;
+
+ static const Int_t fgkNcutVar = 14;
+ 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];
+
+public:
+ CascadeList(Reve::TrackRnrStyle* rs=0);
+ CascadeList(const Text_t* name, Reve::TrackRnrStyle* rs=0);
+
+ 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, Color_t cBach)
+ { fNegColor = cNeg; fPosColor = cPos; fBachColor = cBach; }
+
+ virtual Bool_t CanEditMainColor() { return kTRUE; }
+
+ virtual void Paint(Option_t* option="");
+
+ void SetRnrStyle(Reve::TrackRnrStyle* rst) { fRnrStyle= rst; }
+ Reve::TrackRnrStyle* GetRnrStyle() { return fRnrStyle; }
+
+ Bool_t GetRnrCasVtx() const { return fRnrCasVtx; }
+ Bool_t GetRnrCasPath() const { return fRnrCasPath; }
+ Bool_t GetRnrV0vtx() const { return fRnrV0vtx; }
+ Bool_t GetRnrV0path() const { return fRnrV0path; }
+ Bool_t GetRnrV0Daughters() const { return fRnrV0Daughters; }
+ Bool_t GetRnrBachelor() const { return fRnrBach; }
+
+ void SetRnrV0vtx(Bool_t);
+ void SetRnrV0path(Bool_t);
+ void SetRnrV0Daughters(Bool_t);
+ void SetRnrBachelor(Bool_t);
+ void SetRnrCasPath(Bool_t);
+ void SetRnrCasVtx(Bool_t);
+ void SetMin(Int_t i, Float_t val) {
+ if ((i>=0)&&(i<fgkNcutVar)) fMin[i]=val;}
+ void SetMax(Int_t i, Float_t val) {
+ if ((i>=0)&&(i<fgkNcutVar)) fMax[i]=val;}
+
+ void MakeCascades();
+
+ TH1F* GetHist(Int_t i) {
+ if ((i>=0)&&(i<fgkNcutVar)) return fHist[i]; else return 0;}
+ TH2F* GetHist2D(Int_t i) {
+ if ((i>=0)&&(i<fgkNcutVar2D)) return fHist2D[i]; else return 0;}
+ Float_t GetMin(Int_t i) {
+ if ((i>=0)&&(i<fgkNcutVar)) return fMin[i]; else return 0;}
+ Float_t GetMax(Int_t i) {
+ if ((i>=0)&&(i<fgkNcutVar)) return fMax[i]; else return 0;}
+ void GetCasIndexRange(Int_t &imin, Int_t &imax);
+
+ void AdjustHist(Int_t iHist);
+ void UnFill(Cascade* cas);
+ void Filter(Cascade* cas);
+ void FilterAll();
+
+ void XiMassFilter(Float_t min, Float_t max);
+ void OmegaMassFilter(Float_t min, Float_t max);
+ void IndexFilter(Float_t min, Float_t max);
+ void CosPointingFilter(Float_t min, Float_t max);
+ void BachV0DCAFilter(Float_t min, Float_t max);
+ void RadiusFilter(Float_t min, Float_t max);
+ void PtFilter(Float_t min, Float_t max);
+ void PseudoRapFilter(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 BachPtFilter(Float_t min, Float_t max);
+ void BachEtaFilter(Float_t min, Float_t max);
+
+ //--------------------------------
+
+ ClassDef(CascadeList, 1); // A list of Cascade objects.
+};
+
+} // namespace Alieve
+
+#endif
--- /dev/null
+
+/***********************************************************************
+ 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 "CascadeEditors.h"
+#include <Alieve/Cascade.h>
+
+#include <Reve/RGValuators.h>
+
+#include <TVirtualPad.h>
+#include <TColor.h>
+
+#include <TGLabel.h>
+#include <TGButton.h>
+#include <TGNumberEntry.h>
+#include <TGColorSelect.h>
+#include <TGDoubleSlider.h>
+
+#include <TGTab.h>
+#include <TRootEmbeddedCanvas.h>
+#include <TCanvas.h>
+#include <TH1.h>
+#include <TH1F.h>
+#include <TH2F.h>
+
+
+using namespace Reve;
+using namespace Alieve;
+
+//______________________________________________________________________
+// CascadeListEditor
+//
+
+ClassImp(Alieve::CascadeListEditor)
+
+CascadeListEditor::CascadeListEditor(const TGWindow *p,
+ Int_t width, Int_t height,
+ UInt_t options, Pixel_t back) :
+ TGedFrame(p, width, height, options | kVerticalFrame, back),
+ fMList(0),
+ fRnrV0Daughters(0),
+ fRnrV0path(0),
+ fRnrVtx(0),
+ fRnrBach(0),
+ fRnrCasPath(0),
+ fMainTabA(0),
+ fMainTabB(0)
+{
+ MakeTitle("CascadeList");
+
+ //TGHorizontalFrame* frame = new TGHorizontalFrame(this);
+
+ // --- Rendering control
+
+ fRnrVtx = new TGCheckButton(this, "Render v0 and cascade vertices");
+ AddFrame(fRnrVtx, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+ fRnrVtx->Connect("Toggled(Bool_t)",
+ "Alieve::CascadeListEditor", this, "DoRnrVtx()");
+
+ fRnrV0path = new TGCheckButton(this, "Render v0 path");
+ AddFrame(fRnrV0path, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+ fRnrV0path->Connect("Toggled(Bool_t)",
+ "Alieve::CascadeListEditor", this, "DoRnrV0path()");
+
+ fRnrCasPath = new TGCheckButton(this, "Render cascade path");
+ AddFrame(fRnrCasPath, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+ fRnrCasPath->Connect("Toggled(Bool_t)",
+ "Alieve::CascadeListEditor", this, "DoRnrCasPath()");
+
+ fRnrV0Daughters = new TGCheckButton(this, "Render v0 daughter tracks");
+ AddFrame(fRnrV0Daughters, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+ fRnrV0Daughters->Connect("Toggled(Bool_t)",
+ "Alieve::CascadeListEditor", this, "DoRnrV0Daughters()");
+
+ fRnrBach = new TGCheckButton(this, "Render bachelor track");
+ AddFrame(fRnrBach, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+ fRnrBach->Connect("Toggled(Bool_t)",
+ "Alieve::CascadeListEditor", this, "DoRnrBach()");
+
+ for (Int_t i=0; i<fgkNRange; i++) fRange[i]=0;
+ for (Int_t i=0; i<fgkNCanvas; i++) fCanvasA[i]=0;
+ for (Int_t i=0; i<fgkNCanvas; i++) fCanvasB[i]=0;
+
+ AddSelectTab();
+ AddSeeTab();
+
+ TGTextButton* resetCutsButton = new TGTextButton(this, "Reset all cuts", 40);
+ resetCutsButton->Connect("Clicked()", "Alieve::CascadeListEditor", this, "ResetCuts()");
+ AddFrame(resetCutsButton, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+}
+
+CascadeListEditor::~CascadeListEditor()
+{}
+
+
+//_________________________________________________________________________
+void CascadeListEditor::SetModel(TObject* obj)
+{
+ fMList = dynamic_cast<CascadeList*>(obj);
+
+ for (Int_t i=0; i<fgkNRange; i++)
+ if (fRange[i])
+ fRange[i]->SetValues( fMList->GetMin(i), fMList->GetMax(i) );
+
+ fRnrV0Daughters->SetState(fMList->GetRnrV0Daughters() ? kButtonDown : kButtonUp);
+ fRnrV0path->SetState(fMList->GetRnrV0path() ? kButtonDown : kButtonUp);
+ fRnrVtx->SetState(fMList->GetRnrCasVtx() ? kButtonDown : kButtonUp);
+ fRnrBach->SetState(fMList->GetRnrBachelor() ? kButtonDown : kButtonUp);
+ fRnrCasPath->SetState(fMList->GetRnrCasPath() ? kButtonDown : kButtonUp);
+
+ FillCanvas();
+}
+
+
+//_________________________________________________________________________
+TGCompositeFrame* CascadeListEditor::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** CascadeListEditor::CreateTab(TGTab **pMainTab, TGTab **ptab, Int_t can) {
+
+ //------
+ // tab widget
+ pMainTab[0] = new TGTab(this,0,0);
+ pMainTab[0]->Connect("Selected(Int_t)", "Alieve::CascadeListEditor", 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)", "Alieve::CascadeListEditor", this, "UpdateSelectedTab()");
+ frameTab1->AddFrame(ptab[0], new TGLayoutHints(kLHintsLeft| kLHintsExpandX,0,0,0,0));
+
+ //------
+ // container of "Tab2"
+ TGCompositeFrame *frameTab2 = pMainTab[0]->AddTab("cascade");
+ 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)", "Alieve::CascadeListEditor", this, "UpdateSelectedTab()");
+ frameTab2->AddFrame(ptab[1], new TGLayoutHints(kLHintsLeft| kLHintsExpandX ,0,0,0,0));
+
+ //------
+ // container of "Tab3"
+ TGCompositeFrame *frameTab3 = pMainTab[0]->AddTab("V0daugh/bach.");
+ 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)", "Alieve::CascadeListEditor", 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, "Xi");
+ frameTab[1] = AddTab(ptab[0], 1, can, "Omega");
+ frameTab[2] = AddTab(ptab[0], 2, can, "Arm.Podo.");
+ frameTab[3] = AddTab(ptab[0], 3, can, "Index");
+
+ frameTab[4] = AddTab(ptab[1], 4, can, "cosPointing");
+ frameTab[5] = AddTab(ptab[1], 5, can, "bachV0DCA");
+ frameTab[6] = AddTab(ptab[1], 6, can, "radius");
+ frameTab[7] = AddTab(ptab[1], 7, can, "Pt");
+ frameTab[8] = AddTab(ptab[1], 8, can, "eta");
+
+ frameTab[9] = AddTab(ptab[2], 9, can, "neg Pt");
+ frameTab[10] = AddTab(ptab[2], 10, can, "neg eta");
+ frameTab[11] = AddTab(ptab[2], 11, can, "pos Pt");
+ frameTab[12] = AddTab(ptab[2], 12, can, "pos eta");
+ frameTab[13] = AddTab(ptab[2], 13, can, "bach Pt");
+ frameTab[14] = AddTab(ptab[2], 14, can, "bach 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 CascadeListEditor::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()",
+ "Alieve::CascadeListEditor", 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()", "Alieve::CascadeListEditor", this, ch);
+ downFrame->AddFrame(adjustButton, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
+
+ frame->AddFrame(downFrame, new TGLayoutHints(kLHintsTop| kLHintsExpandY,
+ 0, 0, 0, 0));
+}
+
+
+//_________________________________________________________________________
+void CascadeListEditor::AddSelectTab() {
+
+ TGCompositeFrame** tab = CreateTab(&fMainTabA, fTabA, 1);
+
+ AddValuator(tab[0], "mass Xi", 0, 5, 3, "MassXiRange()", 0);
+ AddValuator(tab[1], "mass Omega", 0, 5, 3, "MassOmegaRange()", 1);
+
+ AddValuator(tab[3], "Index", 0, 1e5, 0, "IndexRange()", 2);
+ AddValuator(tab[4], "cos pointing angle", 0.8, 1, 5, "CosPointingRange()", 3);
+ AddValuator(tab[5], "bach-V0 DCA", 0, 5, 3, "BachV0DCARange()", 4);
+ AddValuator(tab[6], "radius", 0, 100, 2, "RadiusRange()", 5);
+ AddValuator(tab[7], "Pt", 0, 10, 2, "PtRange()", 6);
+ AddValuator(tab[8], "Pseudo-rapidity", -2, 2, 2, "PseudoRapRange()", 7);
+
+ AddValuator(tab[9], "neg Pt", 0, 10, 2, "NegPtRange()", 8);
+ AddValuator(tab[10], "neg pseudo-rapidity", -2, 2, 2, "NegEtaRange()", 9);
+ AddValuator(tab[11], "pos Pt", 0, 10, 2, "PosPtRange()", 10);
+ AddValuator(tab[12], "pos pseudo-rapidity", -2, 2, 2, "PosEtaRange()", 11);
+ AddValuator(tab[13], "bach. Pt", 0, 10, 2, "BachPtRange()", 12);
+ AddValuator(tab[14], "bach. pseudo-rapidity", -2, 2, 2, "BachEtaRange()", 13);
+
+ delete[] tab;
+}
+
+
+//_________________________________________________________________________
+void CascadeListEditor::AddSeeTab() {
+
+ TGCompositeFrame** tab = CreateTab(&fMainTabB, fTabB, 2);
+ delete[] tab;
+}
+
+
+//_________________________________________________________________________
+void CascadeListEditor::AdjustHist(Int_t iHist) {
+
+ if (! fMList) return;
+ fMList->AdjustHist(iHist);
+
+ FillCanvas();
+}
+
+//_________________________________________________________________________
+void CascadeListEditor::ResetCuts() {
+
+ if (! fMList) return;
+
+ Float_t min,max;
+
+ for (Int_t i=0; i<fgkNRange;i++) {
+
+ if (i==2) continue;
+ min = fRange[i]->GetLimitMin();
+ max = fRange[i]->GetLimitMax();
+ fMList->SetMin(i, min);
+ fMList->SetMax(i, max);
+ fRange[i]->SetValues(min, max);
+ fMList->AdjustHist(i);
+ }
+
+ // for the Index we scan its actual range
+ Int_t imin, imax;
+ fMList->GetCasIndexRange(imin, imax);
+ if (imin<imax) {
+ Int_t minH = imin-(imax-imin)/20;
+ Int_t maxH = imax+(imax-imin)/20;
+ fMList->SetMin(2, minH);
+ fMList->SetMax(2, maxH);
+ fRange[2]->SetLimits(minH, maxH, TGNumberFormat::kNESInteger);
+ fRange[2]->SetValues(minH, maxH);
+ fMList->AdjustHist(2);
+
+ }
+ FillCanvas();
+ Update();
+}
+
+
+//_________________________________________________________________________
+void CascadeListEditor::FillCanvas() {
+
+ fMList->FilterAll();
+
+ TCanvas *c1, *c1b;
+ TH1F *hist = 0;
+ TH2F *hist2D = 0;
+ Bool_t is2D;
+
+ Int_t canvasMap[fgkNCanvas]={0,1,1000,2,3,4,5,6,7,8,9,10,11,12,13};
+
+ for (Int_t i=0; i<fgkNCanvas; i++)
+ if (fCanvasA[i]) {
+
+ is2D = canvasMap[i]>999;
+
+ 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 CascadeListEditor::UpdateSelectedTab() {
+
+ Int_t i,j;
+ Pixel_t yellow;
+ Pixel_t grey;
+ gClient->GetColorByName("yellow", yellow);
+ gClient->GetColorByName("grey", grey);
+
+ TGTabElement *tabElem;
+ for (i=0; i<fMainTabA->GetNumberOfTabs(); i++) {
+
+ tabElem = fMainTabA->GetTabTab(i);
+ tabElem->ChangeBackground(grey);
+
+ for (j=0; j<fTabA[i]->GetNumberOfTabs();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;
+ i=0;
+
+ while (currentTab>i) {
+ iCan += fTabA[i]->GetNumberOfTabs();
+ i++;
+ }
+ iCan += currentSubTab;
+ c1 = fCanvasA[iCan]->GetCanvas();
+ c1->GetCanvas()->Modified();
+ c1->GetCanvas()->Update();
+
+ //---
+
+ for (i=0; i<fMainTabB->GetNumberOfTabs(); i++) {
+
+ tabElem = fMainTabB->GetTabTab(i);
+ tabElem->ChangeBackground(grey);
+
+ for (j=0; j<fTabB[i]->GetNumberOfTabs();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 CascadeListEditor::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 CascadeListEditor::DoRnrVtx()
+{
+ fMList->SetRnrCasVtx(fRnrVtx->IsOn());
+ Update();
+}
+
+void CascadeListEditor::DoRnrV0path()
+{
+ fMList->SetRnrV0path(fRnrV0path->IsOn());
+ Update();
+}
+
+void CascadeListEditor::DoRnrV0Daughters()
+{
+ fMList->SetRnrV0Daughters(fRnrV0Daughters->IsOn());
+ Update();
+}
+
+void CascadeListEditor::DoRnrBach()
+{
+ fMList->SetRnrBachelor(fRnrBach->IsOn());
+ Update();
+}
+
+void CascadeListEditor::DoRnrCasPath()
+{
+ fMList->SetRnrCasPath(fRnrCasPath->IsOn());
+ Update();
+}
+
+
+//_________________________________________________________________________
+void CascadeListEditor::MassXiRange() {
+
+ fMList->XiMassFilter(fRange[0]->GetMin(), fRange[0]->GetMax());
+ UpdateAll(0);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::MassOmegaRange() {
+ fMList->OmegaMassFilter(fRange[1]->GetMin(), fRange[1]->GetMax());
+ UpdateAll(1);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::IndexRange() {
+ fMList->IndexFilter(fRange[2]->GetMin(), fRange[2]->GetMax());
+ UpdateAll(3);
+}
+//_________________________________________________________________________
+ void CascadeListEditor::CosPointingRange() {
+ fMList->CosPointingFilter(fRange[3]->GetMin(), fRange[3]->GetMax());
+ UpdateAll(4);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::BachV0DCARange() {
+ fMList->BachV0DCAFilter(fRange[4]->GetMin(), fRange[4]->GetMax());
+ UpdateAll(5);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::RadiusRange() {
+ fMList->RadiusFilter(fRange[5]->GetMin(), fRange[5]->GetMax());
+ UpdateAll(6);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::PtRange() {
+ fMList->PtFilter(fRange[6]->GetMin(), fRange[6]->GetMax());
+ UpdateAll(7);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::PseudoRapRange() {
+ fMList->PseudoRapFilter(fRange[7]->GetMin(), fRange[7]->GetMax());
+ UpdateAll(8);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::NegPtRange() {
+ fMList->NegPtFilter(fRange[8]->GetMin(), fRange[8]->GetMax());
+ UpdateAll(9);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::NegEtaRange() {
+ fMList->NegEtaFilter(fRange[9]->GetMin(), fRange[9]->GetMax());
+ UpdateAll(10);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::PosPtRange() {
+ fMList->PosPtFilter(fRange[10]->GetMin(), fRange[10]->GetMax());
+ UpdateAll(11);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::PosEtaRange() {
+ fMList->PosEtaFilter(fRange[11]->GetMin(), fRange[11]->GetMax());
+ UpdateAll(12);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::BachPtRange() {
+ fMList->BachPtFilter(fRange[12]->GetMin(), fRange[12]->GetMax());
+ UpdateAll(13);
+}
+
+//_________________________________________________________________________
+ void CascadeListEditor::BachEtaRange() {
+ fMList->BachEtaFilter(fRange[13]->GetMin(), fRange[13]->GetMax());
+ UpdateAll(14);
+}
+
+
--- /dev/null
+/***********************************************************************
+ This editor appears in the Reve window when cascades are visualize.
+It allows to select the cascades as a function of some useful parameters.
+
+Ludovic Gaudichet (gaudichet@to.infn.it)
+************************************************************************/
+
+
+#ifndef ALIEVE_CascadeEditors_H
+#define ALIEVE_CascadeEditors_H
+
+#include <TGedFrame.h>
+
+class TGCheckButton;
+class TGNumberEntry;
+class TGColorSelect;
+class TRootEmbeddedCanvas;
+class TH1F;
+class TGCompositeFrame;
+class TGTab;
+
+namespace Reve
+{
+class RGValuator;
+class RGDoubleValuator;
+}
+
+namespace Alieve
+{
+class CascadeList;
+
+class CascadeListEditor : public TGedFrame
+{
+ CascadeListEditor(const CascadeListEditor&); // Not implemented
+ CascadeListEditor& operator=(const CascadeListEditor&); // Not implemented
+
+protected:
+ CascadeList* fMList; // fModel dynamic-casted to CascadeListEditor
+
+ TGCheckButton* fRnrV0Daughters;
+ TGCheckButton* fRnrV0path;
+ TGCheckButton* fRnrVtx;
+ TGCheckButton* fRnrBach;
+ TGCheckButton* fRnrCasPath;
+
+ TGTab *fMainTabA;
+ TGTab *fMainTabB;
+ TGTab *fTabA[3];
+ TGTab *fTabB[3];
+ static const Int_t fgkNRange = 14;
+ Reve::RGDoubleValuator *fRange[fgkNRange];
+
+ static const Int_t fgkNCanvas = 15;
+ 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:
+ CascadeListEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30,
+ UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
+ ~CascadeListEditor();
+
+ virtual void SetModel(TObject* obj);
+ void DoRnrV0Daughters();
+ void DoRnrV0path();
+ void DoRnrVtx();
+ void DoRnrBach();
+ void DoRnrCasPath();
+
+ void FillCanvas();
+ void UpdateSelectedTab();
+ void AdjustHist(Int_t iHist);
+ void ResetCuts();
+
+ void MassXiRange();
+ void MassOmegaRange();
+ void IndexRange();
+ void CosPointingRange();
+ void BachV0DCARange();
+ void RadiusRange();
+ void PtRange();
+ void PseudoRapRange();
+ void NegPtRange();
+ void NegEtaRange();
+ void PosPtRange();
+ void PosEtaRange();
+ void BachPtRange();
+ void BachEtaRange();
+
+ ClassDef(CascadeListEditor, 1); // Editor for CascadeList
+}; // endclass CascadeListEditor
+
+} // namespace Alieve
+
+#endif
--- /dev/null
+/**************************************************************************
+ * 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 "V0.h"
+
+#include <Reve/Track.h>
+#include <Reve/MCHelixLine.hi>
+
+#include <TPolyLine3D.h>
+#include <TPolyMarker3D.h>
+#include <TColor.h>
+
+#include <Reve/ReveManager.h>
+#include <TCanvas.h>
+#include <TH1F.h>
+#include <TH2F.h>
+
+#include <vector>
+
+using namespace Reve;
+using namespace Alieve;
+
+
+/***********************************************************************
+*
+* V0 class
+*
+************************************************************************/
+
+const Float_t V0::fgkMassPion2 = 0.13956995*0.13956995;
+const Float_t V0::fgkMassProton2 = 0.93827231*0.93827231;
+
+ClassImp(Alieve::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)
+{
+ 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<MCVertex> 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<Reve::PathMark*>::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<Reve::PathMark*>::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<MCVertex>::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<MCVertex> 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<MCVertex>::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 V0::GetAlphaArmenteros() const
+{
+ 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 V0::GetPtArmenteros() const
+{
+ 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(Alieve::V0List)
+
+//______________________________________________________________________
+V0List::V0List() :
+ RenderElementList(),
+ fTitle(),
+ fRnrStyle(0),
+ fRnrDaughters(kTRUE),
+ fRnrV0vtx(kTRUE),
+ fRnrV0path(kTRUE),
+ fNegColor(0),
+ fPosColor(0)
+{
+ fChildClass = V0::Class(); // override member from base RenderElementList
+
+ for (Int_t i=0; i<fgkNcutVar; i++)
+ fHist[i] = 0;
+ for (Int_t i=0; i<fgkNcutVar2D; i++)
+ fHist2D[i] = 0;
+}
+
+//______________________________________________________________________
+V0List::V0List(TrackRnrStyle* rs) :
+ RenderElementList(),
+ fTitle(),
+ fRnrStyle(rs),
+ fRnrDaughters(kTRUE),
+ fRnrV0vtx(kTRUE),
+ fRnrV0path(kTRUE),
+ fNegColor(0),
+ fPosColor(0)
+{
+ fChildClass = V0::Class(); // override member from base RenderElementList
+
+ Init();
+}
+
+//______________________________________________________________________
+V0List::V0List(const Text_t* name, TrackRnrStyle* rs) :
+ RenderElementList(),
+ fTitle(),
+ fRnrStyle(rs),
+ fRnrDaughters(kTRUE),
+ fRnrV0vtx(kTRUE),
+ fRnrV0path(kTRUE),
+ fNegColor(0),
+ fPosColor(0)
+{
+ fChildClass = V0::Class(); // override member from base RenderElementList
+
+ Init();
+ SetName(name);
+}
+
+//______________________________________________________________________
+void V0List::Init()
+{
+ if (fRnrStyle== 0) fRnrStyle = new TrackRnrStyle;
+
+ 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; i<fgkNcutVar; i++) {
+ fHist[i]->GetXaxis()->SetLabelSize(0.07);
+ fHist[i]->GetYaxis()->SetLabelSize(0.07);
+ fHist[i]->SetStats(0);
+ }
+ for (Int_t i=0; i<fgkNcutVar2D; i++) {
+ fHist2D[i]->GetXaxis()->SetLabelSize(0.07);
+ fHist2D[i]->GetYaxis()->SetLabelSize(0.07);
+ fHist2D[i]->SetStats(0);
+ }
+}
+
+//______________________________________________________________________
+V0List::~V0List() {
+
+ for (Int_t i=0; i<fgkNcutVar; i++)
+ if (fHist[i]) delete fHist[i];
+ for (Int_t i=0; i<fgkNcutVar2D; i++)
+ if (fHist2D[i]) delete fHist2D[i];
+
+}
+
+//______________________________________________________________________
+void V0List::Paint(Option_t* option) {
+ if(fRnrSelf) {
+
+ if(fRnrV0vtx) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ if((*i)->GetRnrSelf()) {
+ ((V0*)(*i))->Paint(option);
+ }
+ }
+ }
+
+ if(fRnrDaughters) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ if((*i)->GetRnrSelf()) {
+ ((V0*)(*i))->PaintDaughters(option);
+ }
+ }
+ }
+
+ if(fRnrV0path) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ if((*i)->GetRnrSelf()) {
+ ((V0*)(*i))->PaintPath(option);
+ }
+ }
+ }
+ }
+}
+
+
+//______________________________________________________________________
+
+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(List_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 ((iHist<0)||(iHist>=fgkNcutVar)) return;
+ 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 ((pt<fMin[0])||(pt>fMax[0])) return;
+
+ Float_t k0sMass = v0->GetK0mass();
+ if ( (k0sMass<fMin[1])||(k0sMass>fMax[1]) ) return;
+
+ Float_t lamMass = v0->GetLamMass();
+ if ( (lamMass<fMin[2])||(lamMass>fMax[2]) ) return;
+
+ Float_t alamMass = v0->GetAntiLamMass();
+ if ( (alamMass<fMin[3])||(alamMass>fMax[3]) ) return;
+
+ Float_t daughtDCA = v0->GetDaughterDCA();
+ if ( (daughtDCA<fMin[4])||(daughtDCA>fMax[4]) ) return;
+
+ Float_t cosPointing = v0->GetCosPointingAngle();
+ if ( (cosPointing<fMin[5])||(cosPointing>fMax[5]) ) return;
+
+
+ Float_t radius = v0->GetRadius();
+ if ( (radius<fMin[6])||(radius>fMax[6]) ) return;
+
+ Float_t pseudoRapidity = v0->GetPseudoRapidity();
+ if ( (pseudoRapidity<fMin[7])||(pseudoRapidity>fMax[7]) ) return;
+
+ Float_t negPt = v0->GetNegPt();
+ if ( (negPt<fMin[8])||(negPt>fMax[8]) ) return;
+
+ Float_t negPseudoRapidity = v0->GetNegPseudoRapidity();
+ if ( (negPseudoRapidity<fMin[9])||(negPseudoRapidity>fMax[9]) ) return;
+
+ Float_t posPt = v0->GetPosPt();
+ if ( (posPt<fMin[10])||(posPt>fMax[10]) ) return;
+
+ Float_t posPseudoRapidity = v0->GetPosPseudoRapidity();
+ if ( (posPseudoRapidity<fMin[11])||(posPseudoRapidity>fMax[11]) ) return;
+
+ Float_t esdIndex = v0->GetESDIndex();
+ if ( (esdIndex<fMin[12])||(esdIndex>fMax[12]) ) return;
+
+ Float_t alphaArm = v0->GetAlphaArmenteros();
+// if ( (alphaArm<fMinX[0])||(alphaArm>fMaxX[0]) ) return;
+
+ Float_t ptArm = v0->GetPtArmenteros();
+// if ( (ptArm<fMinY[0])||(ptArm>fMaxY[0]) ) return;
+
+ v0->SetRnrSelf(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; i<fgkNcutVar; i++)
+ fHist[i]->Reset();
+
+ for (Int_t i=0; i<fgkNcutVar2D; i++)
+ fHist2D[i]->Reset();
+
+ V0* myV0;
+ for(List_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;
+ List_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 (index<imin) imin = index;
+ if (index>imax) 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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetPt();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetK0mass();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetLamMass();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetAntiLamMass();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetCosPointingAngle();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetDaughterDCA();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetRadius();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetPseudoRapidity();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetNegPt();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetNegPseudoRapidity();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetPosPt();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetPosPseudoRapidity();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(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(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+
+ myV0 = (V0*)(*i);
+ val = myV0->GetESDIndex();
+ wasSelected = myV0->GetRnrSelf();
+ isSelected = ( (val>=min) && (val<=max) );
+
+ if (wasSelected) {
+ if (! isSelected) {
+ UnFill(myV0);
+ myV0->SetRnrSelf(isSelected);
+ }
+ } else {
+ if (isSelected) Filter(myV0);
+ }
+ }
+}
+
--- /dev/null
+#ifndef ALIEVE_V0_H
+#define ALIEVE_V0_H
+
+/* 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)
+************************************************************************/
+
+#include <Reve/PODs.h>
+#include <Reve/RenderElement.h>
+#include <Reve/Track.h>
+
+#include <TPolyMarker3D.h>
+#include <TPolyLine3D.h>
+
+class TH1F;
+class TH2F;
+
+
+namespace Alieve {
+
+class V0List;
+
+class V0 : public Reve::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,
+ Reve::TrackRnrStyle* rs);
+ virtual ~V0();
+
+ typedef std::vector<Reve::PathMark*> vpPathMark_t;
+ typedef std::vector<Reve::PathMark*>::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(fRnrSelf) {fPolyLineNeg.Paint(option);fPolyLinePos.Paint(option);} }
+ virtual void Paint(Option_t* option="") {
+ if(fRnrSelf) TPolyMarker3D::Paint(option);}
+ virtual void PaintPath(Option_t* option="") {
+ if(fRnrSelf) 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(Reve::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 GetDaughterDCA() const;
+ Float_t GetCosPointingAngle() const;
+ Float_t GetRadius() const;
+ Float_t GetDecayLength() const;
+
+ Float_t GetP2() const;
+ Float_t GetMomentum() const;
+ Float_t GetPt() const;
+ Float_t GetPt2() const;
+ Float_t GetPx() const;
+ Float_t GetPy() const;
+ Float_t GetPz() const;
+ Float_t GetPseudoRapidity() const;
+ Float_t GetAlphaArmenteros() const;
+ Float_t GetPtArmenteros() const;
+
+ Float_t GetK0sE() const {return 0;};
+ Float_t GetLamE() const {return 0;};
+ Float_t GetAntiLamE() const {return 0;};
+ Float_t GetK0mass() const;
+ Float_t GetLamMass() const;
+ Float_t GetAntiLamMass() const;
+
+ Float_t GetPionMinusE() const;
+ Float_t GetPionPlusE() const;
+ Float_t GetProtonE() const;
+ Float_t GetPBarE() const;
+
+ Float_t GetPosDCAtoPrim() const;
+ Float_t GetPosP2() const;
+ Float_t GetPosP() const;
+ Float_t GetPosPt() const;
+ Float_t GetPosPseudoRapidity() const;
+
+ Float_t GetNegDCAtoPrim() const;
+ Float_t GetNegP2() const;
+ Float_t GetNegP() const;
+ Float_t GetNegPt() const;
+ Float_t GetNegPseudoRapidity() const;
+ Int_t GetESDIndex() const {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; }
+ Reve::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;
+ Reve::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); // Visual representation of a V0.
+}; // 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 V0::GetPt2() const {
+ Float_t px = fP_neg.x+fP_pos.x, py = fP_neg.y+fP_pos.y;
+ return (px*px+py*py);
+}
+
+inline Float_t V0::GetP2() const {
+
+ 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 V0::GetPt() const {
+ return sqrt(GetPt2());
+}
+
+inline Float_t V0::GetMomentum() const {
+ return sqrt(GetP2());
+}
+
+inline Float_t V0::GetPx() const {
+ return (fP_neg.x+fP_pos.x);
+}
+
+inline Float_t V0::GetPy() const {
+ return (fP_neg.y+fP_pos.y);
+}
+
+inline Float_t V0::GetPz() const {
+ return (fP_neg.z+fP_pos.z);
+}
+
+//______________________________________________________________________
+
+inline Float_t V0::GetDaughterDCA() const {
+ return fDaughterDCA;
+}
+
+inline Float_t V0::GetCosPointingAngle() const {
+return fCosPointingAngle;
+}
+
+inline Float_t V0::GetRadius() const {
+ return sqrt(fV_v0.x*fV_v0.x + fV_v0.y*fV_v0.y);
+}
+
+inline Float_t V0::GetDecayLength() const {
+return fDecayLength;
+}
+
+inline Float_t V0::GetPseudoRapidity() const {
+ Float_t theta = acos( GetPz()/GetMomentum() );
+ return ( -log(tan(theta/2.)) );
+}
+
+//______________________________________________________________________
+
+inline Float_t V0::GetPionMinusE() const {
+ return sqrt(fgkMassPion2+GetNegP2());
+}
+
+inline Float_t V0::GetPionPlusE() const {
+ return sqrt(fgkMassPion2+GetPosP2());
+}
+inline Float_t V0::GetProtonE() const {
+ return sqrt(fgkMassProton2+GetPosP2());
+
+}
+inline Float_t V0::GetPBarE() const {
+ return sqrt(fgkMassProton2+GetNegP2());
+}
+
+//______________________________________________________________________
+
+inline Float_t V0::GetPosP2() const {
+ return (fP_pos.x*fP_pos.x + fP_pos.y*fP_pos.y + fP_pos.z*fP_pos.z);
+}
+
+inline Float_t V0::GetPosP() const {
+ return sqrt(GetPosP2());
+}
+
+inline Float_t V0::GetPosPt() const {
+ return sqrt(fP_pos.x*fP_pos.x + fP_pos.y*fP_pos.y);
+}
+
+inline Float_t V0::GetPosPseudoRapidity() const {
+ Float_t theta = acos( fP_pos.z/GetPosP() );
+ return ( -log(tan(theta/2.)) );
+}
+
+inline Float_t V0::GetPosDCAtoPrim() const {
+ return 0;
+}
+
+//______________________________________________________________________
+inline Float_t V0::GetNegP2() const {
+ return (fP_neg.x*fP_neg.x + fP_neg.y*fP_neg.y + fP_neg.z*fP_neg.z);
+}
+
+inline Float_t V0::GetNegP() const {
+ return sqrt(GetNegP2());
+}
+
+inline Float_t V0::GetNegPt() const {
+ return sqrt(fP_neg.x*fP_neg.x + fP_neg.y*fP_neg.y);
+}
+
+inline Float_t V0::GetNegPseudoRapidity() const {
+ Float_t theta = acos( fP_neg.z/GetNegP() );
+ return ( -log(tan(theta/2.)) );
+}
+
+inline Float_t V0::GetNegDCAtoPrim() const {
+ return 0;
+}
+
+//______________________________________________________________________
+
+inline Float_t V0::GetK0mass() const {
+ Float_t energy = GetPionMinusE() + GetPionPlusE();
+ return sqrt( energy*energy - GetP2() );
+}
+
+inline Float_t V0::GetLamMass() const {
+ Float_t energy = GetPionMinusE() + GetProtonE();
+ return sqrt( energy*energy - GetP2() );
+}
+
+inline Float_t V0::GetAntiLamMass() const {
+ Float_t energy = GetPionPlusE() + GetPBarE();
+ return sqrt( energy*energy - GetP2() );
+}
+
+
+
+/**************************************************************************/
+// V0List
+/**************************************************************************/
+
+class V0List : public Reve::RenderElementList
+{
+ V0List(const V0List&); // Not implemented
+ V0List& operator=(const V0List&); // Not implemented
+
+public:
+ V0List();
+ V0List(Reve::TrackRnrStyle* rs);
+ V0List(const Text_t* name, Reve::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="");
+
+ void SetRnrStyle(Reve::TrackRnrStyle* rst) { fRnrStyle= rst; }
+ Reve::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<fgkNcutVar)) fMin[i]=val;}
+ void SetMax(Int_t i, Float_t val) {
+ if ((i>=0)&&(i<fgkNcutVar)) fMax[i]=val;}
+
+ void MakeV0s();
+ void MakeMarkers();
+
+ TH1F* GetHist(Int_t i) {
+ if ((i>=0)&&(i<fgkNcutVar)) return fHist[i]; else return 0;}
+ TH2F* GetHist2D(Int_t i) {
+ if ((i>=0)&&(i<fgkNcutVar2D)) return fHist2D[i]; else return 0;}
+ Float_t GetMin(Int_t i) {
+ if ((i>=0)&&(i<fgkNcutVar)) return fMin[i]; else return 0;}
+ Float_t GetMax(Int_t i) {
+ if ((i>=0)&&(i<fgkNcutVar)) return fMax[i]; else return 0;}
+ void GetV0IndexRange(Int_t &imin, Int_t &imax);
+
+ Float_t GetMaxR() const { return fRnrStyle->fMaxZ; }
+ 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;
+
+ Reve::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); // A list of V0 objecs.
+};
+
+
+} // namespace Alieve
+
+#endif
--- /dev/null
+/**************************************************************************
+ * 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 <Alieve/V0.h>
+
+#include <Reve/RGValuators.h>
+
+#include <TVirtualPad.h>
+#include <TColor.h>
+
+#include <TGLabel.h>
+#include <TGButton.h>
+#include <TGNumberEntry.h>
+#include <TGColorSelect.h>
+#include <TGDoubleSlider.h>
+
+#include <TGTab.h>
+#include <TRootEmbeddedCanvas.h>
+#include <TCanvas.h>
+#include <TH1.h>
+#include <TH1F.h>
+#include <TH2F.h>
+
+
+using namespace Reve;
+using namespace Alieve;
+
+//______________________________________________________________________
+// V0ListEditor
+//
+
+ClassImp(Alieve::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)",
+ "Alieve::V0ListEditor", this, "DoRnrV0path()");
+
+ fRnrV0vtx = new TGCheckButton(this, "Render v0 vertices");
+ AddFrame(fRnrV0vtx, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+ fRnrV0vtx->Connect("Toggled(Bool_t)",
+ "Alieve::V0ListEditor", this, "DoRnrV0vtx()");
+
+ fRnrV0sDaugh = new TGCheckButton(this, "Render v0 daughters");
+ AddFrame(fRnrV0sDaugh, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+ fRnrV0sDaugh->Connect("Toggled(Bool_t)",
+ "Alieve::V0ListEditor", this, "DoRnrDaughters()");
+
+ for (Int_t i=0; i<fgkNRange; i++) fRange[i]=0;
+ for (Int_t i=0; i<fgkNCanvas; i++) fCanvasA[i]=0;
+
+ AddSelectTab();
+ AddSeeTab();
+
+ TGTextButton* resetCutsButton = new TGTextButton(this, "Reset all cuts", 40);
+ resetCutsButton->Connect("Clicked()", "Alieve::V0ListEditor", this, "ResetCuts()");
+ AddFrame(resetCutsButton, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+}
+
+V0ListEditor::~V0ListEditor() {}
+
+
+//_________________________________________________________________________
+void V0ListEditor::SetModel(TObject* obj)
+{
+ fMList = dynamic_cast<V0List*>(obj);
+
+ for (Int_t i=0; i<fgkNRange; i++)
+ if (fRange[i]) {
+ fRange[i]->SetValues( 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)", "Alieve::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)", "Alieve::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)", "Alieve::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)", "Alieve::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()",
+ "Alieve::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()", "Alieve::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;
+
+ Float_t min,max;
+
+ for (Int_t i=0; i<fgkNRange;i++) {
+
+ if (i==12) continue;
+ min = fRange[i]->GetLimitMin();
+ max = fRange[i]->GetLimitMax();
+ fMList->SetMin(i, min);
+ fMList->SetMax(i, max);
+ fRange[i]->SetValues(min, max);
+ fMList->AdjustHist(i);
+ }
+
+ // for the Index we scan its actual range
+ Int_t imin, imax;
+ fMList->GetV0IndexRange(imin, imax);
+ if (imin<imax) {
+ Int_t minH = imin - (imax-imin)/20;
+ Int_t maxH = imax + (imax-imin)/20;
+ fMList->SetMin(12, minH);
+ fMList->SetMax(12, maxH);
+ fRange[12]->SetLimits(minH, maxH, TGNumberFormat::kNESInteger);
+ fRange[12]->SetValues(minH, maxH);
+ fMList->AdjustHist(12);
+
+ }
+ FillCanvas();
+ Update();
+}
+
+
+
+//_________________________________________________________________________
+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; i<fgkNCanvas; i++)
+ if (fCanvasA[i]) {
+
+ is2D = canvasMap[i]>999;
+
+ 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() {
+
+ Int_t i, j;
+ Pixel_t yellow;
+ Pixel_t grey;
+ gClient->GetColorByName("yellow", yellow);
+ gClient->GetColorByName("grey", grey);
+
+ TGTabElement *tabElem;
+ for (i=0; i<fMainTabA->GetNumberOfTabs(); i++) {
+
+ tabElem = fMainTabA->GetTabTab(i);
+ tabElem->ChangeBackground(grey);
+
+ for (j=0; j<fTabA[i]->GetNumberOfTabs();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;
+ i=0;
+
+ while (currentTab>i) {
+ iCan += fTabA[i]->GetNumberOfTabs();
+ i++;
+ }
+ iCan += currentSubTab;
+ c1 = fCanvasA[iCan]->GetCanvas();
+ c1->GetCanvas()->Modified();
+ c1->GetCanvas()->Update();
+
+ //---
+
+ for (i=0; i<fMainTabB->GetNumberOfTabs(); i++) {
+
+ tabElem = fMainTabB->GetTabTab(i);
+ tabElem->ChangeBackground(grey);
+
+ for (j=0; j<fTabB[i]->GetNumberOfTabs();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(13);
+}
+
--- /dev/null
+
+/* 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 ALIEVE_V0Editors_H
+#define ALIEVE_V0Editors_H
+
+#include <TGedFrame.h>
+
+class TGCheckButton;
+class TGNumberEntry;
+class TGColorSelect;
+class TRootEmbeddedCanvas;
+class TH1F;
+class TGCompositeFrame;
+class TGTab;
+
+namespace Reve
+{
+class RGValuator;
+class RGDoubleValuator;
+}
+
+namespace Alieve
+{
+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;
+ Reve::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
+
+} // end namespace Alieve
+
+#endif