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