]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/blacklisted-classes/Cascade.cxx
Moving 4 classes from MUONcore in MUONgraphics
[u/mrichter/AliRoot.git] / EVE / Alieve / blacklisted-classes / Cascade.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18
19 /***********************************************************************
20 *  This code defines the reconstructed cascades visualized with EVE
21 *
22 * Ludovic Gaudichet (gaudichet@to.infn.it)
23 ************************************************************************/
24
25 #include "Cascade.h"
26
27 #include <Reve/Track.h>
28 #include <Reve/MCHelixLine.hi>
29
30 #include <TPolyLine3D.h>
31 #include <TPolyMarker3D.h>
32 #include <TColor.h>
33
34 // Updates
35 #include <Reve/ReveManager.h>
36 #include <TCanvas.h>
37 #include <TH1F.h>
38 #include <TH2F.h>
39
40 #include <vector>
41
42
43 using namespace Reve;
44 using namespace Alieve;
45
46
47 /***********************************************************************
48 *
49 *  Cascade class
50 *
51 ************************************************************************/
52
53 const Float_t Cascade::fgkMassPion2 = 0.13956995*0.13956995;
54 const Float_t Cascade::fgkMassKaon2 = 0.493677*0.493677;
55 const Float_t Cascade::fgkMassProton2 = 0.93827231*0.93827231;
56 const Float_t Cascade::fgkMassLambda2 = 1.115683*1.115683;
57
58 ClassImp(Alieve::Cascade)
59
60
61 Cascade::Cascade() :
62   RenderElement(),
63   TPolyMarker3D(1),
64   fV_neg(),
65   fP_neg(),
66   fV_pos(),
67   fP_pos(),
68   fV_bach(),
69   fP_bach(),
70   fV_decay(),
71   fV_birth(),
72   fPathMarksNeg(),
73   fPathMarksPos(),
74   fPathMarksBach(),
75   fRnrStyle(0),
76   fPolyLineNeg(),
77   fPolyLinePos(),
78   fPolyLineBach(),
79   fPolyLineV0(),
80   fPolyLineCas(),
81   fBeta_neg(0),
82   fBeta_pos(0),
83   fBeta_bach(0),
84   fESDIndex(-1),
85   fDCA_v0_Bach(999),
86   fCasCosPointingAngle(999),
87   fCasDecayLength(999)
88 {
89   fPolyLinePos.SetLineColor(2);  // red
90   fPolyLineNeg.SetLineColor(7);  // light blue
91   fPolyLineBach.SetLineColor(4);  //  blue
92
93   fMarkerStyle = 20;
94   fMarkerColor = 5;
95   fMarkerSize = 0.3;
96 }
97
98
99
100 Cascade::Cascade(TrackRnrStyle* rs) :
101   RenderElement(),
102   TPolyMarker3D(1),
103   fV_neg(),
104   fP_neg(),
105   fV_pos(),
106   fP_pos(),
107   fV_bach(),
108   fP_bach(),
109   fV_decay(),
110   fV_birth(),
111   fPathMarksNeg(),
112   fPathMarksPos(),
113   fPathMarksBach(),
114   fRnrStyle(rs),
115   fPolyLineNeg(),
116   fPolyLinePos(),
117   fPolyLineBach(),
118   fPolyLineV0(),
119   fPolyLineCas(),
120   fBeta_neg(0),
121   fBeta_pos(0),
122   fBeta_bach(0),
123   fESDIndex(-1),
124   fDCA_v0_Bach(999),
125   fCasCosPointingAngle(999),
126   fCasDecayLength(999)
127 {
128   fMarkerColor = fRnrStyle->fFVAtt.GetMarkerColor();
129   fPolyLineV0.SetLineColor(fMarkerColor);
130   fPolyLinePos.SetLineColor(2);  // red
131   fPolyLineNeg.SetLineColor(7);  // light blue
132   fPolyLineBach.SetLineColor(4);  //  blue
133
134   fMainColorPtr = &fMarkerColor;
135   fMarkerStyle = 20;
136   fMarkerColor = 5;
137   fMarkerSize = 0.3;
138 }
139
140
141 Cascade::~Cascade()
142 {
143   for (vpPathMark_i i=fPathMarksNeg.begin(); i!=fPathMarksNeg.end(); ++i)
144     delete *i;
145   for (vpPathMark_i i=fPathMarksPos.begin(); i!=fPathMarksPos.end(); ++i)
146     delete *i;
147   for (vpPathMark_i i=fPathMarksBach.begin(); i!=fPathMarksBach.end(); ++i)
148     delete *i;
149 }
150 void Cascade::Reset(TPolyLine3D* polyLine) {
151   //polyLine->SetPolyLine(n_points);
152   polyLine->SetPolyLine(0);
153 }
154
155
156 //______________________________________________________________________
157 void Cascade::SetDecayLength(Float_t primx, Float_t primy, Float_t primz) {
158
159
160   Float_t dx = fV_decay.x-primx;
161   Float_t dy = fV_decay.y-primy;
162   Float_t dz = fV_decay.z-primz;
163
164   fCasDecayLength = sqrt(dx*dx+dy*dy+dz*dz);
165   // This is probably wrong but I can only do this for now
166   Float_t distNorm = fCasDecayLength/GetMomentum();
167   fV_birth.x = fV_decay.x - distNorm*GetPx();
168   fV_birth.y = fV_decay.y - distNorm*GetPy();
169   fV_birth.z = fV_decay.z - distNorm*GetPz();
170
171   fV_bach.x = fV_decay.x;
172   fV_bach.y = fV_decay.y;
173   fV_bach.z = fV_decay.z;
174 }
175
176
177 //______________________________________________________________________
178 void Cascade::MakeTrack(vpPathMark_t& pathMark, Reve::Vector& vtx,  Reve::Vector& p,
179                    Int_t charge, Float_t beta, TPolyLine3D& polyLine) {
180
181   TrackRnrStyle& RS((fRnrStyle != 0) ? *fRnrStyle : TrackRnrStyle::fgDefStyle);
182
183   Float_t px = p.x, py = p.y, pz = p.z;  
184
185   MCVertex  mc_v0;
186   mc_v0.x = vtx.x;
187   mc_v0.y = vtx.y; 
188   mc_v0.z = vtx.z; 
189   mc_v0.t = 0;
190
191   std::vector<MCVertex> track_points;
192   Bool_t decay = kFALSE;
193
194   if ((TMath::Abs(vtx.z) > RS.fMaxZ) || (vtx.x*vtx.x + vtx.y*vtx.y > RS.fMaxR*RS.fMaxR)) 
195     goto make_polyline;
196   
197   if (TMath::Abs(RS.fMagField) > 1e-5) {
198
199     // Charged particle in magnetic field
200
201     Float_t a = RS.fgkB2C * RS.fMagField * charge;
202    
203     MCHelix helix(fRnrStyle, &mc_v0, TMath::C()*beta, &track_points, a); //m->cm
204     helix.Init(TMath::Sqrt(px*px+py*py), pz);
205    
206     if(!pathMark.empty()){
207       for(std::vector<Reve::PathMark*>::iterator i=pathMark.begin();
208           i!=pathMark.end(); ++i) {
209
210         Reve::PathMark* pm = *i;
211         
212         if(RS.fFitDaughters &&  pm->type == Reve::PathMark::Daughter){
213           if(TMath::Abs(pm->V.z) > RS.fMaxZ 
214              || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR )
215             goto helix_bounds;
216
217           //printf("%s fit daughter  \n", fName.Data()); 
218           helix.LoopToVertex(p.x, p.y, p.z, pm->V.x, pm->V.y, pm->V.z);
219           p.x -=  pm->P.x;
220           p.y -=  pm->P.y;
221           p.z -=  pm->P.z;
222         }
223         if(RS.fFitDecay &&  pm->type == Reve::PathMark::Decay){
224           
225           if(TMath::Abs(pm->V.z) > RS.fMaxZ 
226              || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR )
227             goto helix_bounds;
228           helix.LoopToVertex(p.x, p.y, p.z, pm->V.x, pm->V.y, pm->V.z);
229           decay = true;
230           break;
231         }
232       }
233     }
234   helix_bounds:
235     //go to bounds
236     if(!decay || RS.fFitDecay == kFALSE){
237       helix.LoopToBounds(px,py,pz);
238       // printf("%s loop to bounds  \n",fName.Data() );
239     }
240
241   } else {
242
243     // Neutral particle or no field
244
245     MCLine line(fRnrStyle, &mc_v0, TMath::C()*beta, &track_points);
246    
247     if(!pathMark.empty()) {
248       for(std::vector<Reve::PathMark*>::iterator i=pathMark.begin();
249           i!=pathMark.end(); ++i) {
250         Reve::PathMark* pm = *i;
251
252         if(RS.fFitDaughters &&  pm->type == Reve::PathMark::Daughter){
253           if(TMath::Abs(pm->V.z) > RS.fMaxZ 
254              || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR )
255             goto line_bounds;
256           line.GotoVertex(pm->V.x, pm->V.y, pm->V.z);
257           p.x -=  pm->P.x;
258           p.y -=  pm->P.y;
259           p.z -=  pm->P.z;
260         }
261
262         if(RS.fFitDecay &&  pm->type == Reve::PathMark::Decay){
263           if(TMath::Abs(pm->V.z) > RS.fMaxZ 
264              || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR )
265             goto line_bounds;
266           line.GotoVertex(pm->V.x, pm->V.y, pm->V.z);
267           decay = true;
268           break;
269         }
270       }
271     }
272
273   line_bounds:
274     if(!decay || RS.fFitDecay == kFALSE)
275       line.GotoBounds(px,py,pz);
276
277   }
278 make_polyline:
279   Reset(&polyLine);
280   for(std::vector<MCVertex>::iterator i=track_points.begin();
281       i!=track_points.end(); ++i) {
282     polyLine.SetNextPoint(i->x,i->y, i->z);
283   }
284
285 }
286
287 //______________________________________________________________________
288 void Cascade::MakeV0path() {
289   
290   MCVertex  mc_v0;
291   mc_v0.x = (fV_neg.x+fV_pos.x)/2;
292   mc_v0.y = (fV_neg.y+fV_pos.y)/2;
293   mc_v0.z = (fV_neg.z+fV_pos.z)/2;
294   mc_v0.t = 0;
295
296   std::vector<MCVertex> track_points;
297   MCLine line(fRnrStyle, &mc_v0, TMath::C()*0.99, &track_points);
298
299  line.GotoVertex(fV_decay.x,fV_decay.y,fV_decay.z);
300
301   Reset(&fPolyLineV0);
302   for(std::vector<MCVertex>::iterator i=track_points.begin();
303       i!=track_points.end(); ++i) {
304     fPolyLineV0.SetNextPoint(i->x,i->y, i->z);
305   }
306
307 }
308
309 //______________________________________________________________________
310 void Cascade::MakeCasPath() {
311   
312   MCVertex  mc_v0;
313   mc_v0.x = fV_birth.x;
314   mc_v0.y = fV_birth.y;
315   mc_v0.z = fV_birth.z;
316   mc_v0.t = 0;
317
318   std::vector<MCVertex> track_points;
319   MCLine line(fRnrStyle, &mc_v0, TMath::C()*0.99, &track_points);
320
321  line.GotoVertex(fV_decay.x,fV_decay.y,fV_decay.z);
322
323   Reset(&fPolyLineCas);
324   for(std::vector<MCVertex>::iterator i=track_points.begin();
325       i!=track_points.end(); ++i) {
326     fPolyLineCas.SetNextPoint(i->x,i->y, i->z);
327   }
328 }
329
330
331 //______________________________________________________________________
332 void Cascade::MakeCascade()
333 {
334   SetNextPoint(fV_neg.x, fV_neg.y, fV_neg.z);
335   SetNextPoint(fV_decay.x, fV_decay.y, fV_decay.z);
336
337   MakeTrack(fPathMarksNeg, fV_neg, fP_neg, -1, fBeta_neg, fPolyLineNeg);
338   MakeTrack(fPathMarksPos, fV_pos, fP_pos,  1, fBeta_pos, fPolyLinePos);
339   if (fBeta_bach>0)
340     MakeTrack(fPathMarksBach, fV_bach, fP_bach,  1, fBeta_bach, fPolyLineBach);
341   else 
342     MakeTrack(fPathMarksBach, fV_bach, fP_bach, -1, -fBeta_bach, fPolyLineBach);
343   MakeV0path();
344   MakeCasPath();
345 }
346
347
348
349
350 //______________________________________________________________________
351 Float_t Cascade::GetCasAlphaArmenteros() const
352 {
353   Float_t px = GetPx(), py = GetPy(), pz = GetPz();
354   Float_t posXcas, negXcas;
355
356   if (fBeta_bach>0) {
357     posXcas = fP_bach.x*px + fP_bach.y*py + fP_bach.z*pz;
358     negXcas = (fP_neg.x+fP_pos.x)*px + (fP_neg.y+fP_pos.y)*py + (fP_neg.z+fP_pos.z)*pz;
359   } else {
360     posXcas = (fP_neg.x+fP_pos.x)*px + (fP_neg.y+fP_pos.y)*py + (fP_neg.z+fP_pos.z)*pz;
361     negXcas = fP_bach.x*px + fP_bach.y*py + fP_bach.z*pz;
362   }
363
364   if (posXcas + negXcas > 1.e-39)
365     return (posXcas - negXcas)/(posXcas + negXcas);
366   else return -999;
367 }
368
369
370 //______________________________________________________________________
371 Float_t Cascade::GetCasPtArmenteros() const
372 {
373   Float_t px = GetPx(), py = GetPy(), pz = GetPz();
374   Float_t p2 = px*px + py*py + pz*pz;
375   if (p2 < 1.e-39) return  -999;
376   
377   Float_t posXcas, posP2;
378   
379   if (fBeta_bach>0) {
380     posXcas = fP_bach.x*px + fP_bach.y*py + fP_bach.z*pz;
381     posP2 = GetBachP2();
382   } else {
383     posXcas = (fP_neg.x+fP_pos.x)*px + (fP_neg.y+fP_pos.y)*py + (fP_neg.z+fP_pos.z)*pz;
384     posP2 = GetV0P2();
385   }
386   return sqrt( posP2 - posXcas*posXcas/p2 );
387 }
388
389
390
391 /***********************************************************************
392 *
393 *  CascadeList class
394 *
395 ************************************************************************/
396
397 ClassImp(Alieve::CascadeList)
398
399
400 //______________________________________________________________________
401 CascadeList::CascadeList(TrackRnrStyle* rs) :
402   RenderElementList(),
403   fTitle(),
404   fRnrStyle(rs),
405   fRnrBach(kTRUE),
406   fRnrV0Daughters(kTRUE),
407   fRnrV0vtx(kTRUE),
408   fRnrV0path(kTRUE),
409   fRnrCasVtx(kTRUE),
410   fRnrCasPath(kTRUE),
411   fNegColor(0),
412   fPosColor(0),
413   fBachColor(0)
414 {
415   fChildClass = Cascade::Class(); // override member from base RenderElementList
416
417   Init();
418 }
419
420
421 //______________________________________________________________________
422 CascadeList::CascadeList(const Text_t* name, TrackRnrStyle* rs) :
423   RenderElementList(),
424   fTitle(),
425   fRnrStyle(rs),
426   fRnrBach(kTRUE),
427   fRnrV0Daughters(kTRUE),
428   fRnrV0vtx(kTRUE),
429   fRnrV0path(kTRUE),
430   fRnrCasVtx(kTRUE),
431   fRnrCasPath(kTRUE),
432   fNegColor(0),
433   fPosColor(0),
434   fBachColor(0)
435 {
436   fChildClass = Cascade::Class(); // override member from base RenderElementList
437
438   Init();
439   SetName(name);
440 }
441
442
443 //______________________________________________________________________
444 void CascadeList::Init()
445 {
446   if (fRnrStyle== 0) fRnrStyle = new TrackRnrStyle;
447
448   fMin[0]  =  0;     fMax[0]  = 5; // Xi mass
449   fMin[1]  =  0;     fMax[1]  = 5; // Omega mass
450   fMin[2]  =  0;     fMax[2]  = 1e5; // Index
451   fMin[3]  =  0.8;   fMax[3]  = 1; // cosPointingAngle
452   fMin[4]  =  0;     fMax[4]  = 5; // bachV0DCA
453   fMin[5]  =  0;     fMax[5]  = 100; // radius
454   fMin[6]  =  0;     fMax[6]  = 10; // Pt
455   fMin[7]  = -2;     fMax[7]  = 2; // PseudoRapidity
456   fMin[8]  =  0;     fMax[8]  = 10; // negPt
457   fMin[9]  = -2;     fMax[9]  = 2; // negEta
458   fMin[10] =  0;    fMax[10]  = 10; // posPt
459   fMin[11] = -2;    fMax[11]  = 2; // posEta
460   fMin[12] =  0;    fMax[12]  = 10; // bachPt
461   fMin[13] = -2;    fMax[13]  = 2; // backEta
462
463   char *ch = "XiMass";
464   fHist[0] = new TH1F(ch,ch, 100, fMin[0], fMax[0]);
465   ch = "OmegaMass";
466   fHist[1] = new TH1F(ch,ch, 100, fMin[1], fMax[1]);
467   ch = "Index";
468   fHist[2] = new TH1F(ch,ch, 100, fMin[2], fMax[2]);
469
470   ch = "cosPointingAngle";
471   fHist[3] = new TH1F(ch,ch, 100, fMin[3], fMax[3]);
472   ch = "bachV0DCA";
473   fHist[4] = new TH1F(ch,ch, 100, fMin[4], fMax[4]);
474   ch = "radius";
475   fHist[5] = new TH1F(ch,ch, 100, fMin[5], fMax[5]);
476   ch = "Pt";
477   fHist[6] = new TH1F(ch,ch, 100, fMin[6], fMax[6]);
478   ch = "PseudoRapidity";
479   fHist[7] = new TH1F(ch,ch, 100, fMin[7], fMax[7]);
480
481   ch = "negPt";
482   fHist[8] = new TH1F(ch,ch, 100, fMin[8], fMax[8]);
483   ch = "negEta";
484   fHist[9] = new TH1F(ch,ch, 100, fMin[9], fMax[9]);
485   ch = "posPt";
486   fHist[10] = new TH1F(ch,ch, 100, fMin[10], fMax[10]);
487   ch = "posEta";
488   fHist[11] = new TH1F(ch,ch, 100, fMin[11], fMax[11]);
489   ch = "bachPt";
490   fHist[12] = new TH1F(ch,ch, 100, fMin[12], fMax[12]);
491   ch = "backEta";
492   fHist[13] = new TH1F(ch,ch, 100, fMin[13], fMax[13]);
493
494   fMinX[0] = -1.2;
495   fMaxX[0] = 1.2;
496   fMinY[0] = 0;
497   fMaxY[0] = 0.4;
498   ch = "ArmenterosPodolansky";
499   fHist2D[0] = new TH2F(ch,ch, 70, fMinX[0], fMaxX[0], 70,
500                         fMinY[0], fMaxY[0]);
501
502   for (Int_t i=0; i<fgkNcutVar; i++) {
503     fHist[i]->GetXaxis()->SetLabelSize(0.07);
504     fHist[i]->GetYaxis()->SetLabelSize(0.07);
505     fHist[i]->SetStats(0);
506   }
507   for (Int_t i=0; i<fgkNcutVar2D; i++) {
508     fHist2D[i]->GetXaxis()->SetLabelSize(0.07);
509     fHist2D[i]->GetYaxis()->SetLabelSize(0.07);
510     fHist2D[i]->SetStats(0);
511   }
512 }
513
514
515 //______________________________________________________________________
516 void CascadeList::Paint(Option_t* option) {
517   if(fRnrSelf) {
518
519     if(fRnrBach) {
520       for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
521         if((*i)->GetRnrSelf()) {
522           ((Cascade*)(*i))->PaintBachelor(option);
523         }
524       }
525     }
526
527     if(fRnrV0Daughters) {
528       for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
529         if((*i)->GetRnrSelf()) {
530           ((Cascade*)(*i))->PaintV0Daughters(option);
531         }
532       }
533     }
534
535     if(fRnrV0path) {
536       for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
537         if((*i)->GetRnrSelf()) {
538           ((Cascade*)(*i))->PaintV0Path(option);
539         }
540       }
541     }
542
543     if(fRnrCasVtx) {
544       for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
545         if((*i)->GetRnrSelf()) {
546           ((Cascade*)(*i))->Paint(option);
547         }
548       }
549     }
550
551     if(fRnrCasPath) {
552       for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
553         if((*i)->GetRnrSelf()) {
554           ((Cascade*)(*i))->PaintCasPath(option);
555         }
556       }
557     }
558
559   } // end if(fRnrSelf)
560 }
561
562
563 //______________________________________________________________________
564 void CascadeList::SetRnrV0vtx(Bool_t rnr)
565 {
566   fRnrV0vtx = rnr;
567   gReve->Redraw3D();
568 }
569
570 void CascadeList::SetRnrV0path(Bool_t rnr)
571 {
572   fRnrV0path = rnr;
573   gReve->Redraw3D();
574 }
575
576 void CascadeList::SetRnrV0Daughters(Bool_t rnr)
577 {
578   fRnrV0Daughters = rnr;
579   gReve->Redraw3D();
580 }
581
582
583 void CascadeList::SetRnrCasPath(Bool_t rnr)
584 {
585   fRnrCasPath = rnr;
586   gReve->Redraw3D();
587 }
588
589 void CascadeList::SetRnrCasVtx(Bool_t rnr)
590 {
591   fRnrCasVtx = rnr;
592   gReve->Redraw3D();
593 }
594
595 void CascadeList::SetRnrBachelor(Bool_t rnr)
596 {
597   fRnrBach = rnr;
598   gReve->Redraw3D();
599 }
600
601
602 //______________________________________________________________________
603
604 void CascadeList::MakeCascades()
605 {
606   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
607     ((Cascade*)(*i))->MakeCascade();
608   }
609   gReve->Redraw3D();
610 }
611
612 //_________________________________________________________________________
613 void CascadeList::AdjustHist(Int_t iHist) {
614
615   if ((iHist<0)||(iHist>=fgkNcutVar)) return;
616   if (! fHist[iHist]) return;
617   
618   TString name = fHist[iHist]->GetName();
619   Int_t nBin = fHist[iHist]->GetXaxis()->GetNbins();
620   delete fHist[iHist];
621   fHist[iHist] = new TH1F(name.Data(), name.Data(), nBin, GetMin(iHist),
622                           GetMax(iHist));
623   fHist[iHist]->GetXaxis()->SetLabelSize(0.07);
624   fHist[iHist]->GetYaxis()->SetLabelSize(0.07);
625   fHist[iHist]->SetStats(0);
626
627 }
628
629 //______________________________________________________________________
630 void CascadeList::UnFill(Cascade* cas) {
631
632
633     Int_t bin = fHist[0]->GetXaxis()->FindBin(cas->GetXiMass());
634     fHist[0]->SetBinContent( bin, fHist[0]->GetBinContent(bin)-1 );
635
636     bin = fHist[1]->GetXaxis()->FindBin( cas->GetOmegaMass() );
637     fHist[1]->SetBinContent( bin, fHist[1]->GetBinContent(bin)-1 );
638
639
640     bin = fHist[2]->GetXaxis()->FindBin( cas->GetESDIndex() );
641     fHist[2]->SetBinContent( bin, fHist[2]->GetBinContent(bin)-1 );
642
643     bin = fHist[3]->GetXaxis()->FindBin( cas->GetCasCosPointingAngle() );
644     fHist[3]->SetBinContent( bin, fHist[3]->GetBinContent(bin)-1 );
645
646     bin = fHist[4]->GetXaxis()->FindBin( cas->GetDCA_v0_Bach() );
647     fHist[4]->SetBinContent( bin, fHist[4]->GetBinContent(bin)-1 );
648
649     bin = fHist[5]->GetXaxis()->FindBin( cas->GetRadius() );
650     fHist[5]->SetBinContent( bin, fHist[5]->GetBinContent(bin)-1 );
651
652     bin = fHist[6]->GetXaxis()->FindBin( cas->GetPt() );
653     fHist[6]->SetBinContent( bin, fHist[6]->GetBinContent(bin)-1 );
654
655     bin = fHist[7]->GetXaxis()->FindBin( cas->GetPseudoRapidity() );
656     fHist[7]->SetBinContent( bin, fHist[7]->GetBinContent(bin)-1 );
657     //---
658
659     bin = fHist[8]->GetXaxis()->FindBin( cas->GetNegPt() );
660     fHist[8]->SetBinContent( bin, fHist[8]->GetBinContent(bin)-1 );
661
662     bin = fHist[9]->GetXaxis()->FindBin( cas->GetNegPseudoRapidity() );
663     fHist[9]->SetBinContent( bin, fHist[9]->GetBinContent(bin)-1 );
664
665     bin = fHist[10]->GetXaxis()->FindBin( cas->GetPosPt() );
666     fHist[10]->SetBinContent( bin, fHist[10]->GetBinContent(bin)-1 );
667
668     bin = fHist[11]->GetXaxis()->FindBin( cas->GetPosPseudoRapidity() );
669     fHist[11]->SetBinContent( bin, fHist[11]->GetBinContent(bin)-1 );
670
671     bin = fHist[12]->GetXaxis()->FindBin( cas->GetBachPt() );
672     fHist[12]->SetBinContent( bin, fHist[12]->GetBinContent(bin)-1 );
673
674     bin = fHist[13]->GetXaxis()->FindBin( cas->GetBachPseudoRapidity() );
675     fHist[13]->SetBinContent( bin, fHist[13]->GetBinContent(bin)-1 );
676
677     //---
678           bin  = fHist2D[0]->GetXaxis()->FindBin( cas->GetCasAlphaArmenteros() );
679     Int_t binY = fHist2D[0]->GetYaxis()->FindBin( cas->GetCasPtArmenteros() );
680     fHist2D[0]->SetBinContent( bin, binY, fHist2D[0]->GetBinContent(bin,binY)-1 );
681 }
682
683
684 //______________________________________________________________________
685 void CascadeList::Filter(Cascade* cas) {
686
687   Float_t xiMass = cas->GetXiMass();
688   if ((xiMass<fMin[0])||(xiMass>fMax[0])) return;
689
690   Float_t omegaMass = cas->GetOmegaMass();
691   if ( (omegaMass<fMin[1])||(omegaMass>fMax[1]) ) return;
692
693
694   Float_t index = cas->GetESDIndex();
695   if ( (index<fMin[2])||(index>fMax[2]) ) return;
696
697   Float_t cosPointingAngle = cas->GetCasCosPointingAngle();
698   if ( (cosPointingAngle<fMin[3])||(cosPointingAngle>fMax[3]) ) return;
699
700   Float_t bachV0DCA = cas->GetDCA_v0_Bach();
701   if ( (bachV0DCA<fMin[4])||(bachV0DCA>fMax[4]) ) return;
702
703   Float_t radius = cas->GetRadius();
704   if ( (radius<fMin[5])||(radius>fMax[5]) ) return;
705
706   Float_t pt = cas->GetPt();
707   if ( (pt<fMin[6])||(pt>fMax[6]) ) return;
708
709   Float_t pseudoRapidity = cas->GetPseudoRapidity();
710   if ( (pseudoRapidity<fMin[7])||(pseudoRapidity>fMax[7]) ) return;
711
712   Float_t negPt = cas->GetNegPt();
713   if ( (negPt<fMin[8])||(negPt>fMax[8]) ) return;
714
715   Float_t negEta = cas->GetNegPseudoRapidity();
716   if ( (negEta<fMin[9])||(negEta>fMax[9]) ) return;
717
718   Float_t posPt = cas->GetPosPt();
719   if ( (posPt<fMin[10])||(posPt>fMax[10]) ) return;
720
721   Float_t posEta = cas->GetPosPseudoRapidity();
722   if ( (posEta<fMin[11])||(posEta>fMax[11]) ) return;
723
724   Float_t bachPt = cas->GetBachPt();
725   if ( (bachPt<fMin[12])||(bachPt>fMax[12]) ) return;
726
727   Float_t bachEta = cas->GetBachPseudoRapidity();
728   if ( (bachEta<fMin[13])||(bachEta>fMax[13]) ) return;
729
730   cas->SetRnrSelf(kTRUE);
731   fHist[0]->Fill(xiMass);
732   fHist[1]->Fill(omegaMass);
733   fHist[2]->Fill(index);
734   fHist[3]->Fill(cosPointingAngle);
735   fHist[4]->Fill(bachV0DCA);
736   fHist[5]->Fill(radius);
737   fHist[6]->Fill(pt);
738   fHist[7]->Fill(pseudoRapidity);
739   fHist[8]->Fill(negPt);
740   fHist[9]->Fill(negEta);
741   fHist[10]->Fill(posPt);
742   fHist[11]->Fill(posEta);
743   fHist[12]->Fill(bachPt);
744   fHist[13]->Fill(bachEta);
745
746   fHist2D[0]->Fill(cas->GetCasAlphaArmenteros(), cas->GetCasPtArmenteros() );
747 }
748
749 //______________________________________________________________________
750 void CascadeList::FilterAll() {
751
752   for (Int_t i=0; i<fgkNcutVar; i++)
753     fHist[i]->Reset();
754
755   for (Int_t i=0; i<fgkNcutVar2D; i++)
756     fHist2D[i]->Reset();
757   
758   Cascade* myCas;
759   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
760
761     myCas = (Cascade*)(*i);
762     Filter(myCas);
763   }
764 }
765
766
767 //______________________________________________________________________
768 void CascadeList::GetCasIndexRange(Int_t &imin, Int_t &imax) {
769
770   Int_t index;
771   Cascade* myCas;
772   List_i i = fChildren.begin();
773   myCas = (Cascade*)(*i);
774   index = myCas->GetESDIndex();
775   imin = index;
776   imax = index;
777
778   for(; i!=fChildren.end(); ++i) {
779
780     myCas = (Cascade*)(*i);
781     index = myCas->GetESDIndex();
782     if (index<imin) imin = index;
783     if (index>imax) imax = index;
784   }
785 }
786
787 //______________________________________________________________________
788 void CascadeList::XiMassFilter(Float_t min, Float_t max) {
789
790   fMin[0] = min;
791   fMax[0] = max;
792
793   Float_t val;
794   Bool_t wasSelected;
795   Bool_t isSelected;
796   Cascade* myCas;
797
798   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
799
800     myCas = (Cascade*)(*i);
801     val = myCas->GetXiMass();
802     wasSelected = myCas->GetRnrSelf();
803     isSelected = ( (val>=min) && (val<=max) );
804
805     if (wasSelected) {
806       if (! isSelected) {
807         UnFill(myCas);
808         myCas->SetRnrSelf(isSelected);
809       }
810     } else {
811       if (isSelected) Filter(myCas);
812     }
813   }
814 }
815
816 //______________________________________________________________________
817 void CascadeList::OmegaMassFilter(Float_t min, Float_t max) {
818
819   fMin[1] = min;
820   fMax[1] = max;
821
822   Float_t val;
823   Bool_t wasSelected;
824   Bool_t isSelected;
825   Cascade* myCas;
826
827   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
828
829     myCas = (Cascade*)(*i);
830     val = myCas->GetOmegaMass();
831     wasSelected = myCas->GetRnrSelf();
832     isSelected = ( (val>=min) && (val<=max) );
833
834     if (wasSelected) {
835       if (! isSelected) {
836         UnFill(myCas);
837         myCas->SetRnrSelf(isSelected);
838       }
839     } else {
840       if (isSelected) Filter(myCas);
841     }
842   }
843 }
844
845 //______________________________________________________________________
846 void CascadeList::IndexFilter(Float_t min, Float_t max) {
847
848   fMin[2] = min;
849   fMax[2] = max;
850
851   Float_t val;
852   Bool_t wasSelected;
853   Bool_t isSelected;
854   Cascade* myCas;
855
856   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
857
858     myCas = (Cascade*)(*i);
859     val = myCas->GetESDIndex();
860     wasSelected = myCas->GetRnrSelf();
861     isSelected = ( (val>=min) && (val<=max) );
862
863     if (wasSelected) {
864       if (! isSelected) {
865         UnFill(myCas);
866         myCas->SetRnrSelf(isSelected);
867       }
868     } else {
869       if (isSelected) Filter(myCas);
870     }
871   }
872 }
873
874 //______________________________________________________________________
875 void CascadeList::CosPointingFilter(Float_t min, Float_t max) {
876
877   fMin[3] = min;
878   fMax[3] = max;
879
880   Float_t val;
881   Bool_t wasSelected;
882   Bool_t isSelected;
883   Cascade* myCas;
884
885   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
886
887     myCas = (Cascade*)(*i);
888     val = myCas->GetCasCosPointingAngle();
889     wasSelected = myCas->GetRnrSelf();
890     isSelected = ( (val>=min) && (val<=max) );
891
892     if (wasSelected) {
893       if (! isSelected) {
894         UnFill(myCas);
895         myCas->SetRnrSelf(isSelected);
896       }
897     } else {
898       if (isSelected) Filter(myCas);
899     }
900   }
901 }
902
903
904 //______________________________________________________________________
905 void CascadeList::BachV0DCAFilter(Float_t min, Float_t max) {
906
907   fMin[4] = min;
908   fMax[4] = max;
909
910   Float_t val;
911   Bool_t wasSelected;
912   Bool_t isSelected;
913   Cascade* myCas;
914
915   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
916
917     myCas = (Cascade*)(*i);
918     val = myCas->GetDCA_v0_Bach();
919     wasSelected = myCas->GetRnrSelf();
920     isSelected = ( (val>=min) && (val<=max) );
921
922     if (wasSelected) {
923       if (! isSelected) {
924         UnFill(myCas);
925         myCas->SetRnrSelf(isSelected);
926       }
927     } else {
928       if (isSelected) Filter(myCas);
929     }
930   }
931 }
932
933
934 //______________________________________________________________________
935 void CascadeList::RadiusFilter(Float_t min, Float_t max) {
936
937   fMin[5] = min;
938   fMax[5] = max;
939
940   Float_t val;
941   Bool_t wasSelected;
942   Bool_t isSelected;
943   Cascade* myCas;
944
945   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
946
947     myCas = (Cascade*)(*i);
948     val = myCas->GetRadius();
949     wasSelected = myCas->GetRnrSelf();
950     isSelected = ( (val>=min) && (val<=max) );
951
952     if (wasSelected) {
953       if (! isSelected) {
954         UnFill(myCas);
955         myCas->SetRnrSelf(isSelected);
956       }
957     } else {
958       if (isSelected) Filter(myCas);
959     }
960   }
961 }
962
963
964 //______________________________________________________________________
965 void CascadeList::PtFilter(Float_t min, Float_t max) {
966
967   fMin[6] = min;
968   fMax[6] = max;
969
970   Float_t val;
971   Bool_t wasSelected;
972   Bool_t isSelected;
973   Cascade* myCas;
974
975   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
976
977     myCas = (Cascade*)(*i);
978     val = myCas->GetPt();
979     wasSelected = myCas->GetRnrSelf();
980     isSelected = ( (val>=min) && (val<=max) );
981
982     if (wasSelected) {
983       if (! isSelected) {
984         UnFill(myCas);
985         myCas->SetRnrSelf(isSelected);
986       }
987     } else {
988       if (isSelected) Filter(myCas);
989     }
990   }
991 }
992
993
994 //______________________________________________________________________
995 void CascadeList::PseudoRapFilter(Float_t min, Float_t max) {
996
997   fMin[7] = min;
998   fMax[7] = max;
999
1000   Float_t val;
1001   Bool_t wasSelected;
1002   Bool_t isSelected;
1003   Cascade* myCas;
1004
1005   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
1006
1007     myCas = (Cascade*)(*i);
1008     val = myCas->GetPseudoRapidity();
1009     wasSelected = myCas->GetRnrSelf();
1010     isSelected = ( (val>=min) && (val<=max) );
1011
1012     if (wasSelected) {
1013       if (! isSelected) {
1014         UnFill(myCas);
1015         myCas->SetRnrSelf(isSelected);
1016       }
1017     } else {
1018       if (isSelected) Filter(myCas);
1019     }
1020   }
1021 }
1022
1023
1024 //______________________________________________________________________
1025 void CascadeList::NegPtFilter(Float_t min, Float_t max) {
1026
1027   fMin[8] = min;
1028   fMax[8] = max;
1029
1030   Float_t val;
1031   Bool_t wasSelected;
1032   Bool_t isSelected;
1033   Cascade* myCas;
1034
1035   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
1036
1037     myCas = (Cascade*)(*i);
1038     val = myCas->GetNegPt();
1039     wasSelected = myCas->GetRnrSelf();
1040     isSelected = ( (val>=min) && (val<=max) );
1041
1042     if (wasSelected) {
1043       if (! isSelected) {
1044         UnFill(myCas);
1045         myCas->SetRnrSelf(isSelected);
1046       }
1047     } else {
1048       if (isSelected) Filter(myCas);
1049     }
1050   }
1051 }
1052
1053
1054 //______________________________________________________________________
1055 void CascadeList::NegEtaFilter(Float_t min, Float_t max) {
1056
1057   fMin[9] = min;
1058   fMax[9] = max;
1059
1060   Float_t val;
1061   Bool_t wasSelected;
1062   Bool_t isSelected;
1063   Cascade* myCas;
1064
1065   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
1066
1067     myCas = (Cascade*)(*i);
1068     val = myCas->GetNegPseudoRapidity();
1069     wasSelected = myCas->GetRnrSelf();
1070     isSelected = ( (val>=min) && (val<=max) );
1071
1072     if (wasSelected) {
1073       if (! isSelected) {
1074         UnFill(myCas);
1075         myCas->SetRnrSelf(isSelected);
1076       }
1077     } else {
1078       if (isSelected) Filter(myCas);
1079     }
1080   }
1081 }
1082
1083
1084 //______________________________________________________________________
1085 void CascadeList::PosPtFilter(Float_t min, Float_t max) {
1086
1087   fMin[10] = min;
1088   fMax[10] = max;
1089
1090   Float_t val;
1091   Bool_t wasSelected;
1092   Bool_t isSelected;
1093   Cascade* myCas;
1094
1095   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
1096
1097     myCas = (Cascade*)(*i);
1098     val = myCas->GetPosPt();
1099     wasSelected = myCas->GetRnrSelf();
1100     isSelected = ( (val>=min) && (val<=max) );
1101
1102     if (wasSelected) {
1103       if (! isSelected) {
1104         UnFill(myCas);
1105         myCas->SetRnrSelf(isSelected);
1106       }
1107     } else {
1108       if (isSelected) Filter(myCas);
1109     }
1110   }
1111 }
1112
1113 //______________________________________________________________________
1114 void CascadeList::PosEtaFilter(Float_t min, Float_t max) {
1115
1116   fMin[11] = min;
1117   fMax[11] = max;
1118
1119   Float_t val;
1120   Bool_t wasSelected;
1121   Bool_t isSelected;
1122   Cascade* myCas;
1123
1124   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
1125
1126     myCas = (Cascade*)(*i);
1127     val = myCas->GetPosPseudoRapidity();
1128     wasSelected = myCas->GetRnrSelf();
1129     isSelected = ( (val>=min) && (val<=max) );
1130
1131     if (wasSelected) {
1132       if (! isSelected) {
1133         UnFill(myCas);
1134         myCas->SetRnrSelf(isSelected);
1135       }
1136     } else {
1137       if (isSelected) Filter(myCas);
1138     }
1139   }
1140 }
1141
1142
1143 //______________________________________________________________________
1144 void CascadeList::BachPtFilter(Float_t min, Float_t max) {
1145
1146   fMin[12] = min;
1147   fMax[12] = max;
1148
1149   Float_t val;
1150   Bool_t wasSelected;
1151   Bool_t isSelected;
1152   Cascade* myCas;
1153
1154   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
1155
1156     myCas = (Cascade*)(*i);
1157     val = myCas->GetBachPt();
1158     wasSelected = myCas->GetRnrSelf();
1159     isSelected = ( (val>=min) && (val<=max) );
1160
1161     if (wasSelected) {
1162       if (! isSelected) {
1163         UnFill(myCas);
1164         myCas->SetRnrSelf(isSelected);
1165       }
1166     } else {
1167       if (isSelected) Filter(myCas);
1168     }
1169   }
1170 }
1171
1172 //______________________________________________________________________
1173 void CascadeList::BachEtaFilter(Float_t min, Float_t max) {
1174
1175   fMin[13] = min;
1176   fMax[13] = max;
1177
1178   Float_t val;
1179   Bool_t wasSelected;
1180   Bool_t isSelected;
1181   Cascade* myCas;
1182
1183   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
1184
1185     myCas = (Cascade*)(*i);
1186     val = myCas->GetBachPseudoRapidity();
1187     wasSelected = myCas->GetRnrSelf();
1188     isSelected = ( (val>=min) && (val<=max) );
1189
1190     if (wasSelected) {
1191       if (! isSelected) {
1192         UnFill(myCas);
1193         myCas->SetRnrSelf(isSelected);
1194       }
1195     } else {
1196       if (isSelected) Filter(myCas);
1197     }
1198   }
1199 }
1200