00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <iostream>
00024 #include "EvtGenBase/EvtDecayTag.hh"
00025
00026 using std::endl;
00027 using std::fstream;
00028
00029 void EvtDecayTag::makeTag(EvtParticle* par){
00030
00031 int ndaug = par->getNDaug();
00032 if(ndaug < 2){
00033 EvtId id = par->getId();
00034 int theTag = TagIndex(id);
00035 _multiplicity[theTag]++;
00036 } else {
00037
00038 if(par == root_par) {
00039 int theMode = root_par->getChannel();
00040 _nmode.push_back(theMode);
00041 }
00042
00043 int ND=0;
00044 EvtParticle *theD;
00045 for(int i=0;i<ndaug;i++){
00046 EvtParticle *theDaug = par->getDaug(i);
00047 if(par == root_par && theDaug->getNDaug()!=0){
00048 int theMode = theDaug->getChannel();
00049 _nmode.push_back(theMode);
00050 ND++;
00051 theD = theDaug;
00052 }
00053
00054 int id = EvtPDL::getStdHep(theDaug->getId());
00055 if (id == 310) _multiplicity[6]++;
00056 if (id ==3122) _multiplicity[7]++;
00057 makeTag(theDaug);
00058 }
00059
00060 if(ND ==1){
00061 int NDD= theD->getNDaug();
00062 for(int i=0;i<NDD;i++){
00063 EvtParticle *theDD=theD->getDaug(i);
00064 if(theDD->getNDaug() !=0 ){
00065 int ndd = theDD->getChannel();
00066 _nmode.push_back(ndd);
00067 break;
00068 }
00069 }
00070 }
00071
00072 }
00073
00074 }
00075
00076 int EvtDecayTag::TagIndex(EvtId pid){
00089 int id = EvtPDL::getStdHep(pid);
00090 int absid=fabs(id);
00091 if( absid == 22 ) {return 0;}
00092 else if(absid == 11 ) {return 1;}
00093 else if(absid == 13) {return 2;}
00094 else if(absid == 211) {return 3;}
00095 else if(absid == 321) {return 4;}
00096 else if(absid ==2212) {return 5;}
00097 else if(absid == 310) {return 6;}
00098 else if(absid ==3122) {return 7;}
00099 else {return 8;}
00100 }
00101
00102 int EvtDecayTag::getModeTag(){
00103
00104 std::vector<int> intFlag = root_par->getIntFlag();
00105 if(intFlag.size()>0){
00106 if(intFlag[0]==74110) return intFlag[1];
00107 }
00108
00112 double seg0,seg1,seg2;
00113
00114 int three = 1000;
00115 int six = 1000000;
00116 int themode = 1000000000;
00117
00118
00119
00120 if(_nmode.size()==1) {themode += _nmode[0]*six; return themode;}
00121 else if(_nmode.size() == 2){
00122 seg0 = _nmode[0]*six;
00123 seg1 = _nmode[1]*three;
00124 themode += seg0 + seg1;
00125 return themode;
00126 }
00127 else if(_nmode.size() >= 3){
00128 seg0 = _nmode[0]*six;
00129 seg1 = _nmode[1]*three;
00130 seg2 = _nmode[2];
00131 themode += seg0 + seg1 + seg2;
00132 return themode;
00133 }
00134 }
00135
00136 int EvtDecayTag::getMultTag(){
00141 int thetag = 0;
00142 for(int i=1; i<9; i++){
00143 if (_multiplicity[i] >9) return 0;
00144 }
00145 for(int i=0; i<9; i++){
00146 int ndx = 8-i;
00147 int dig = pow(10,ndx);
00148 thetag += dig*_multiplicity[i];
00149 }
00150 return thetag;
00151 }
00152
00153 int EvtDecayTag::getHdrdBase(int index){
00154 int ten = 10;
00155 int base;
00156 if( index ==0 || index>=100 && index <1000) { return index;}
00157 else {
00158 base = index*ten;
00159 getHdrdBase(base);
00160 }
00161 }