Fix for definitions for CINT
[u/mrichter/AliRoot.git] / TEvtGen / EvtGen / EvtGenBase / EvtSecondary.cpp
1 //--------------------------------------------------------------------------
2 //
3 // Environment:
4 //      This software is part of the EvtGen package developed jointly
5 //      for the BaBar and CLEO collaborations.  If you use all or part
6 //      of it, please give an appropriate acknowledgement.
7 //
8 // Copyright Information: See EvtGen/COPYRIGHT
9 //      Copyright (C) 1998      Caltech, UCSB
10 //
11 // Module: EvtSecondary.cc
12 //
13 // Description: Class to store the decays of the secondary particles.
14 //
15 // Modification history:
16 //
17 //    RYD       March 12, 1998       Module created
18 //
19 //------------------------------------------------------------------------
20 //
21 #include "EvtGenBase/EvtPatches.hh"
22 #include "EvtGenBase/EvtPatches.hh"
23 #include <iostream>
24 #include "EvtGenBase/EvtParticle.hh"
25 #include "EvtGenBase/EvtPDL.hh"
26 #include "EvtGenBase/EvtSecondary.hh"
27 #include "EvtGenBase/EvtReport.hh"
28 using std::endl;
29 using std::ostream;
30
31
32 void EvtSecondary::init(){
33   _npart=0;
34 }
35   
36 int EvtSecondary::getNPart(){
37   return _npart;
38 }
39
40 void EvtSecondary::createSecondary(int stdhepindex,EvtParticle* prnt){
41
42   _stdhepindex[_npart]=stdhepindex;
43   if (prnt->getNDaug()==0){
44     _id1[_npart]=0;
45     _id2[_npart]=0;
46     _id3[_npart]=0;
47     _npart++;
48     return;
49   }
50   if (prnt->getNDaug()==1){
51     _id1[_npart]=EvtPDL::getStdHep(prnt->getDaug(0)->getId());
52     _id2[_npart]=0;
53     _id3[_npart]=0;
54     _npart++;
55     return;
56   }
57   if (prnt->getNDaug()==2){
58     _id1[_npart]=EvtPDL::getStdHep(prnt->getDaug(0)->getId());
59     _id2[_npart]=EvtPDL::getStdHep(prnt->getDaug(1)->getId());
60     _id3[_npart]=0;
61     _npart++;
62     return;
63   }
64   if (prnt->getNDaug()==3){
65     _id1[_npart]=EvtPDL::getStdHep(prnt->getDaug(0)->getId());
66     _id2[_npart]=EvtPDL::getStdHep(prnt->getDaug(1)->getId());
67     _id3[_npart]=EvtPDL::getStdHep(prnt->getDaug(2)->getId());
68     _npart++;
69     return;
70   }
71   
72   report(ERROR,"EvtGen") << 
73     "More than 3 decay products in a secondary particle!"<<endl;
74
75
76 }
77  
78
79 ostream& operator<<(ostream& s, const EvtSecondary& secondary){
80
81   s <<endl;
82   s << "Secondary decays:"<<endl;
83
84   int i;
85   for(i=0;i<secondary._npart;i++){
86
87     report(INFO,"EvtGen") <<i<<" "
88          <<secondary._stdhepindex[i]<<" "
89          <<secondary._id1[i]<<" "
90          <<secondary._id2[i]<<" "
91          <<secondary._id3[i]<<endl;
92
93   }
94   
95   s<<endl;
96   
97   return s;
98
99 }  
100