DTagTool Class Reference

#include <DTagTool.h>

List of all members.

Public Member Functions

 DTagTool ()
 ~DTagTool ()
bool isDTagListEmpty ()
void setPID (bool pid)
EvtRecDTagCol::iterator modes_begin ()
EvtRecDTagCol::iterator modes_end ()
EvtRecPi0Col::iterator pi0_begin ()
EvtRecPi0Col::iterator pi0_end ()
EvtRecEtaToGGCol::iterator eta_begin ()
EvtRecEtaToGGCol::iterator eta_end ()
EvtRecVeeVertexCol::iterator ks_begin ()
EvtRecVeeVertexCol::iterator ks_end ()
vector< int > D0modes ()
vector< int > Dpmodes ()
vector< int > Dsmodes ()
vector< int > mode (EvtRecDTag::DecayMode decaymode)
vector< int > mode (int decaymode)
bool findSTag (EvtRecDTag::DecayMode mode, int tagcharm)
bool findSTag (EvtRecDTag::DecayMode mode)
bool findDTag (EvtRecDTag::DecayMode mode1, EvtRecDTag::DecayMode mode2, string smass="mbc")
bool findDTag (EvtRecDTag::DecayMode mode1, int tagcharm1, EvtRecDTag::DecayMode mode2, int tagcharm2, string smass="mbc")
bool findADTag (EvtRecDTag::DecayMode mode1, EvtRecDTag::DecayMode mode2)
bool findADTag (EvtRecDTag::DecayMode mode1, int tagcharm1, EvtRecDTag::DecayMode mode2, int tagcharm2)
bool findSTag (int mode, int tagcharm)
bool findSTag (int mode)
bool findDTag (int mode1, int mode2, string smass="mbc")
bool findDTag (int mode1, int tagcharm1, int mode2, int tagcharm2, string smass="mbc")
bool findADTag (int mode1, int mode2)
bool findADTag (int mode1, int tagcharm1, int mode2, int tagcharm2)
EvtRecDTagCol::iterator stag ()
EvtRecDTagCol::iterator dtag1 ()
EvtRecDTagCol::iterator dtag2 ()
vector< EvtRecDTagCol::iterator > vdtag1 ()
vector< EvtRecDTagCol::iterator > vdtag2 ()
void setdtagDE (double sigma1, double sigma2)
bool compare (EvtRecDTagCol::iterator pair1_iter1, EvtRecDTagCol::iterator pair1_iter2, EvtRecDTagCol::iterator pair2_iter1, EvtRecDTagCol::iterator pair2_iter2, double mD, string smass)
void operator<< (EvtRecDTagCol::iterator iter)
HepLorentzVector pi0p4 (EvtRecPi0Col::iterator pi0Itr, bool isconstrain=true)
HepLorentzVector etap4 (EvtRecEtaToGGCol::iterator etaItr, bool isconstrain=true)
vector< int > pi0Id (EvtRecDTagCol::iterator iter, int numpi0=1)
vector< int > etaId (EvtRecDTagCol::iterator iter, int numeta=1)
vector< int > ksId (EvtRecDTagCol::iterator iter, int numks=1)
HepLorentzVector p4shower (RecEmcShower *shower)
HepLorentzVector p4 (RecMdcKalTrack *mdcKalTrack, int pid)
bool isPion (EvtRecTrack *trk)
bool isKaon (EvtRecTrack *trk)
bool isElectron (EvtRecTrack *trk)
bool isMuon (EvtRecTrack *trk)
bool isGoodTrack (EvtRecTrack *trk)
bool isGoodShower (EvtRecTrack *trk)
bool cosmicandleptonVeto (bool emc=true)
int numofShowerAboveThreshold ()
int numofShowerAboveThreshold (int threshold)
bool shareTracks (EvtRecDTagCol::iterator iter1, EvtRecDTagCol::iterator iter2)
double angleShowerwithTrack (EvtRecTrack *shower, EvtRecTrack *track)
void clear ()
void name ()

Protected Member Functions

IDataProviderSvc * eventSvc ()

Private Attributes

bool m_isdtaglistempty
IDataProviderSvc * m_evtSvc
ISimplePIDSvcm_simplePIDSvc
EvtRecDTagCol::iterator m_iterbegin
EvtRecDTagCol::iterator m_iterend
EvtRecPi0Col::iterator m_pi0iterbegin
EvtRecPi0Col::iterator m_pi0iterend
EvtRecEtaToGGCol::iterator m_etaiterbegin
EvtRecEtaToGGCol::iterator m_etaiterend
EvtRecVeeVertexCol::iterator m_ksiterbegin
EvtRecVeeVertexCol::iterator m_ksiterend
bool m_pid
EvtRecDTagCol::iterator m_iterstag
EvtRecDTagCol::iterator m_iterdtag1
EvtRecDTagCol::iterator m_iterdtag2
vector< EvtRecDTagCol::iterator > m_viterdtag1
vector< EvtRecDTagCol::iterator > m_viterdtag2
double m_tag1desigma
double m_tag2desigma
vector< int > m_d0modes
vector< int > m_dpmodes
vector< int > m_dsmodes
EvtRecTrackIterator m_chargebegin
EvtRecTrackIterator m_chargeend
EvtRecTrackIterator m_showerbegin
EvtRecTrackIterator m_showerend


Detailed Description

Definition at line 27 of file DTagTool.h.


Constructor & Destructor Documentation

DTagTool::DTagTool (  ) 

Definition at line 34 of file DTagTool.cxx.

References eventSvc(), EventModel::EvtRec::EvtRecDTagCol, Bes_Common::FATAL, iter(), m_chargebegin, m_chargeend, m_d0modes, m_dpmodes, m_dsmodes, m_etaiterbegin, m_etaiterend, m_isdtaglistempty, m_iterbegin, m_iterend, m_ksiterbegin, m_ksiterend, m_pi0iterbegin, m_pi0iterend, m_pid, m_showerbegin, m_showerend, and m_simplePIDSvc.

00034                    : m_evtSvc(0), m_iterbegin(0), m_iterend(0),
00035                        m_iterstag(0),  m_iterdtag1(0), m_iterdtag2(0),
00036                        m_chargebegin(0),m_chargeend(0),m_showerbegin(0),m_showerend(0),
00037                        m_tag1desigma(1.0),m_tag2desigma(1.0){
00038   
00039   SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), "/Event/EvtRec/EvtRecEvent");
00040   if ( ! evtRecEvent ) {
00041     cout << MSG::FATAL << "Could not find EvtRecEvent" << endl;
00042     exit(1);
00043   }
00044   
00045   SmartDataPtr<EvtRecTrackCol> evtRecTrackCol( eventSvc(), "/Event/EvtRec/EvtRecTrackCol");
00046   if ( ! evtRecTrackCol ) {
00047     cout << MSG::FATAL << "Could not find EvtRecTrackCol" << endl;
00048     exit(1);
00049   }
00050 
00051 
00052   StatusCode sc = Gaudi::svcLocator()->service("SimplePIDSvc", m_simplePIDSvc);
00053   if ( sc.isFailure() )
00054     {
00055       //log << MSG::FATAL << "Could not load SimplePIDSvc!" << endreq;
00056       exit(1);
00057     }
00058 
00059 
00060 
00061   m_chargebegin=evtRecTrackCol->begin();
00062   m_chargeend=evtRecTrackCol->begin()+evtRecEvent->totalCharged();
00063   m_showerbegin=evtRecTrackCol->begin()+evtRecEvent->totalCharged();
00064   m_showerend=evtRecTrackCol->begin()+evtRecEvent->totalTracks();
00065 
00067   SmartDataPtr<EvtRecDTagCol> evtRecDTagCol(eventSvc(), EventModel::EvtRec::EvtRecDTagCol);
00068   if ( ! evtRecDTagCol ) {
00069     cout << "Could not find EvtRecDTagCol" << endl;
00070     exit(1);
00071   }
00072 
00074   SmartDataPtr<EvtRecVeeVertexCol> evtRecVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
00075   if ( ! evtRecVeeVertexCol ) {
00076     cout<< "Could not find EvtRecVeeVertexCol" << endl;
00077     exit(1);
00078   }
00079 
00081   SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), "/Event/EvtRec/EvtRecPi0Col");
00082   if ( ! recPi0Col ) {
00083     cout<< "Could not find EvtRecPi0Col" << endl;
00084     exit(1);
00085   }
00086 
00088 
00089   SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(eventSvc(), "/Event/EvtRec/EvtRecEtaToGGCol");
00090   if ( ! recEtaToGGCol ) {
00091     cout<< "Could not find EvtRecEtaToGGCol" << endl;
00092     exit(1);
00093   }
00094 
00095 
00096   
00097   m_iterbegin=evtRecDTagCol->begin();
00098   m_iterend=evtRecDTagCol->end();
00099   m_pi0iterbegin=recPi0Col->begin();
00100   m_pi0iterend=recPi0Col->end();
00101   m_etaiterbegin=recEtaToGGCol->begin();
00102   m_etaiterend=recEtaToGGCol->end();
00103   m_ksiterbegin=evtRecVeeVertexCol->begin();
00104   m_ksiterend=evtRecVeeVertexCol->end();
00105   
00106   if(evtRecDTagCol->size() > 0)
00107     m_isdtaglistempty=false;
00108   else
00109     m_isdtaglistempty=true;
00110 
00111   //set initial pid requirement
00112   m_pid=true;
00113 
00114     
00115   //fill d0, dp, ds modes seprately
00116   int index=0;
00117   for(EvtRecDTagCol::iterator iter=m_iterbegin; iter != m_iterend; iter++){
00118 
00119     if( (int)( (*iter)->decayMode())< 200 )
00120       m_d0modes.push_back( index ); 
00121     else  if( (int)( (*iter)->decayMode())< 400 )
00122       m_dpmodes.push_back( index ); 
00123     else  if( (int)( (*iter)->decayMode())< 1000 )
00124       m_dsmodes.push_back( index ); 
00125   
00126     index++;
00127   } 
00128 
00129 }

DTagTool::~DTagTool (  ) 

Definition at line 139 of file DTagTool.cxx.

References m_d0modes, m_dpmodes, and m_dsmodes.

00139                    {
00140 
00141   m_d0modes.clear();
00142   m_dpmodes.clear();
00143   m_dsmodes.clear();
00144 
00145 }


Member Function Documentation

double DTagTool::angleShowerwithTrack ( EvtRecTrack shower,
EvtRecTrack track 
)

Definition at line 1213 of file DTagTool.cxx.

References DstExtTrack::emcPosition(), EvtRecTrack::emcShower(), DstExtTrack::emcVolumeNumber(), EvtRecTrack::extTrack(), EvtRecTrack::isExtTrackValid(), pi, DstEmcShower::x(), DstEmcShower::y(), and DstEmcShower::z().

Referenced by cosmicandleptonVeto().

01213                                                                             {
01214   
01215   double angle=-100;
01216   
01217   RecEmcShower *emcTrk = shower->emcShower();
01218   Hep3Vector emcpos(emcTrk->x(), emcTrk->y(), emcTrk->z());
01219   
01220   
01221   if ( !track->isExtTrackValid() ) return angle;
01222   RecExtTrack* extTrk = track->extTrack();
01223   if ( extTrk->emcVolumeNumber() == -1 ) return angle;
01224   Hep3Vector extpos = extTrk->emcPosition();
01225   if(extpos==(-99,-99,-99))
01226     return angle;
01227   
01228   return extpos.angle(emcpos)*180/CLHEP::pi;
01229   
01230 }

void DTagTool::clear (  ) 

Definition at line 131 of file DTagTool.cxx.

References m_d0modes, m_dpmodes, and m_dsmodes.

Referenced by DSemilepAlg::execute(), and DDecay::execute().

00131                     {
00132 
00133   m_d0modes.clear();
00134   m_dpmodes.clear();
00135   m_dsmodes.clear();
00136   
00137 }

bool DTagTool::compare ( EvtRecDTagCol::iterator  pair1_iter1,
EvtRecDTagCol::iterator  pair1_iter2,
EvtRecDTagCol::iterator  pair2_iter1,
EvtRecDTagCol::iterator  pair2_iter2,
double  mD,
string  smass 
)

Definition at line 147 of file DTagTool.cxx.

References m_tag1desigma, and m_tag2desigma.

Referenced by findDTag().

00147                                                                                                                                                                                       {
00148   
00149   double value1=0;
00150   double value2=0;
00151   if(smass=="mbc"){
00152     value1 = fabs(0.5*((*pair1_iter1)->mBC()+(*pair1_iter2)->mBC())-mD);
00153     value2 = fabs(0.5*((*pair2_iter1)->mBC()+(*pair2_iter2)->mBC())-mD);
00154   }
00155   else if(smass=="de"){
00156     value1 = pow((*pair1_iter1)->deltaE()/m_tag1desigma,2)+pow((*pair1_iter2)->deltaE()/m_tag2desigma,2);
00157     value2 = pow((*pair2_iter1)->deltaE()/m_tag1desigma,2)+pow((*pair2_iter2)->deltaE()/m_tag2desigma,2);
00158   }
00159   else if(smass=="inv"){
00160     value1 = fabs(0.5*((*pair1_iter1)->mass()+(*pair1_iter2)->mass())-mD);
00161     value2 = fabs(0.5*((*pair2_iter1)->mass()+(*pair2_iter2)->mass())-mD);
00162   }
00163   
00164   
00165   if( value1 <= value2)
00166     return true;
00167   else
00168     return false;
00169 }

bool DTagTool::cosmicandleptonVeto ( bool  emc = true  ) 

Definition at line 1134 of file DTagTool.cxx.

References angleShowerwithTrack(), DstEmcShower::energy(), genRecEmupikp::i, isElectron(), isGoodTrack(), isMuon(), iter(), m_chargebegin, m_chargeend, m_showerbegin, m_showerend, and DstEmcShower::time().

Referenced by SD0Tag::execute(), DSemilepAlg::execute(), and DDecay::execute().

01134                                           {
01135   
01136   //good track list
01137   vector<EvtRecTrackIterator> iGood;
01138   iGood.clear();
01139   for(EvtRecTrackIterator iter=m_chargebegin; iter!= m_chargeend; iter++){ 
01140     if(isGoodTrack(*iter))
01141       iGood.push_back(iter);
01142   }
01143   
01144   if(iGood.size() != 2)
01145     return true;
01146   
01147   //cosmic veto
01148   double time1=-99,time2=-99;
01149   for(vector<EvtRecTrackIterator>::size_type i=0;i<2;i++){
01150     if( (*iGood[i])->isTofTrackValid() ){
01151       SmartRefVector<RecTofTrack> tofTrkCol= (*iGood[i])->tofTrack();
01152       SmartRefVector<RecTofTrack>::iterator iter_tof=tofTrkCol.begin();
01153       
01154       for(;iter_tof!=tofTrkCol.end();iter_tof++){
01155         TofHitStatus* status =new TofHitStatus;
01156         status->setStatus( (*iter_tof)->status() );
01157         if(status->is_cluster()){
01158           if(i==0)
01159             time1=(*iter_tof)->tof();
01160           else
01161             time2=(*iter_tof)->tof();
01162         }
01163         delete status;
01164       }
01165     }
01166   }
01167   if( time1!=-99 && time2!=-99 && fabs(time1-time2)>5)
01168     return false;
01169   
01170   //rad bhabha veto
01171   if(isElectron( *iGood[0]) && isElectron(*iGood[1]))
01172     return false;
01173   
01174   //rad dimu veto
01175   if(isMuon( *iGood[0]) && isMuon(*iGood[1]))
01176     return false;
01177 
01178 
01179   //require additonal emc shower in the event
01180   if(emc){
01181 
01182     bool gotgoodshower=false;
01183     
01184     for(EvtRecTrackIterator iter=m_showerbegin; iter!= m_showerend; iter++){ 
01185       
01186       if(!(*iter)->isEmcShowerValid()) continue;
01187       RecEmcShower *emcTrk = (*iter)->emcShower();
01188       
01189       double eraw = emcTrk->energy();
01190       double time = emcTrk->time();
01191       if( !(eraw>0.05 && time>0 && time<14 ))
01192         continue;
01193       
01194       
01195       double angle1=angleShowerwithTrack(*iter, *iGood[0]);
01196       double angle2=angleShowerwithTrack(*iter, *iGood[1]);
01197       
01198       if(angle1>20 && angle2>20){
01199         gotgoodshower=true;
01200         break;
01201       }
01202         
01203       
01204     }
01205 
01206     return gotgoodshower;
01207 
01208   }//end of adding emc
01209 
01210   return true;
01211 }

vector<int> DTagTool::D0modes (  )  [inline]

Definition at line 51 of file DTagTool.h.

References m_d0modes.

Referenced by DDecay::execute().

00051 { return m_d0modes;}

vector<int> DTagTool::Dpmodes (  )  [inline]

Definition at line 52 of file DTagTool.h.

References m_dpmodes.

Referenced by DDecay::execute().

00052 { return m_dpmodes;}

vector<int> DTagTool::Dsmodes (  )  [inline]

Definition at line 53 of file DTagTool.h.

References m_dsmodes.

Referenced by DDecay::execute().

00053 { return m_dsmodes;}

EvtRecDTagCol::iterator DTagTool::dtag1 (  )  [inline]

Definition at line 76 of file DTagTool.h.

References m_iterdtag1.

Referenced by DDecay::execute().

00076 { return m_iterdtag1;}

EvtRecDTagCol::iterator DTagTool::dtag2 (  )  [inline]

Definition at line 77 of file DTagTool.h.

References m_iterdtag2.

Referenced by DDecay::execute().

00077 { return m_iterdtag2;}

EvtRecEtaToGGCol::iterator DTagTool::eta_begin (  )  [inline]

Definition at line 45 of file DTagTool.h.

References m_etaiterbegin.

00045 { return m_etaiterbegin;}

EvtRecEtaToGGCol::iterator DTagTool::eta_end (  )  [inline]

Definition at line 46 of file DTagTool.h.

References m_etaiterend.

00046 { return m_etaiterend;}

vector< int > DTagTool::etaId ( EvtRecDTagCol::iterator  iter,
int  numeta = 1 
)

Definition at line 823 of file DTagTool.cxx.

References genRecEmupikp::i, m_etaiterbegin, m_etaiterend, and EvtRecTrack::trackId().

00823                                                                       {
00824   
00825   SmartRefVector<EvtRecTrack> showers=(*iter_dtag)->showers();
00826   if(showers.size()<2*numeta){
00827     cout<<"too many eta required"<<endl;
00828     exit(1);
00829   }
00830    
00831   vector<int> canid;
00832   canid.clear();
00833 
00834   for(EvtRecEtaToGGCol::iterator etaItr = m_etaiterbegin;
00835       etaItr < m_etaiterend; etaItr++){
00836     
00838     EvtRecTrack* heGammaTrk = const_cast<EvtRecTrack*>((*etaItr)->hiEnGamma());
00839     EvtRecTrack* leGammaTrk = const_cast<EvtRecTrack*>((*etaItr)->loEnGamma());
00840 
00841     int heGammaTrkId = heGammaTrk->trackId();
00842     int leGammaTrkId = leGammaTrk->trackId();
00843     
00844     for(int index=0; index<numeta; ++index){
00845       bool isheid=false;
00846       bool isleid=false;
00847       
00848       for(int i=index*2; i<index*2+2; ++i){
00849         
00850         if(!isheid && heGammaTrkId == showers[i]->trackId())
00851           isheid=true;
00852         if(!isleid && leGammaTrkId == showers[i]->trackId())
00853           isleid=true;
00854       }
00855       
00856       if(isheid && isleid)
00857         canid.push_back( etaItr - m_etaiterbegin); 
00858     }
00859     
00860 
00861     if(canid.size()==numeta){
00862       return canid;
00863       break;
00864     }
00865 
00866   }  // End "etaItr" FOR Loop
00867 
00868   return canid;
00869   
00870 }

HepLorentzVector DTagTool::etap4 ( EvtRecEtaToGGCol::iterator  etaItr,
bool  isconstrain = true 
)

Definition at line 748 of file DTagTool.cxx.

References p4shower().

00748                                                                                  {
00749 
00750 
00751   if(isconstrain){
00752     HepLorentzVector p41= (*etaItr)->hiPfit();
00753     HepLorentzVector p42= (*etaItr)->loPfit();
00754     return (p41+p42);
00755   }
00756   else {
00757     EvtRecTrack* trk1 = const_cast<EvtRecTrack*>((*etaItr)->hiEnGamma());
00758     EvtRecTrack* trk2 = const_cast<EvtRecTrack*>((*etaItr)->loEnGamma());
00759     
00760     RecEmcShower* emctrk1 = (trk1)->emcShower();
00761     RecEmcShower* emctrk2 = (trk2)->emcShower();
00762     
00763     HepLorentzVector p41=p4shower(emctrk1);
00764     HepLorentzVector p42=p4shower(emctrk2);
00765     return (p41+p42);
00766   }  
00767   
00768 }

IDataProviderSvc * DTagTool::eventSvc (  )  [protected]

Definition at line 1258 of file DTagTool.cxx.

References m_evtSvc.

Referenced by DTagTool().

01258                                     {
01259 
01260   if(m_evtSvc == 0){
01261 
01262     StatusCode sc = Gaudi::svcLocator()->service ( "EventDataSvc", m_evtSvc, true);
01263     if( sc.isFailure() ) {
01264       assert(false);
01265     }
01266 
01267   }
01268 
01269   return m_evtSvc;
01270 
01271 }

bool DTagTool::findADTag ( int  mode1,
int  tagcharm1,
int  mode2,
int  tagcharm2 
)

Definition at line 619 of file DTagTool.cxx.

References genRecEmupikp::i, ganga-rec::j, m_iterbegin, m_iterend, m_pid, m_viterdtag1, m_viterdtag2, and shareTracks().

00619                                                                           {
00620 
00621   if(tagcharm1*tagcharm2>0){
00622     cout<<"double tagging warning! two  modes can't have same nonzero charmness"<<endl; 
00623     return false;
00624   }
00625   
00626   //define D candidate mass
00627   double mDcand=0;
00628   if( mode1 < 200 && mode2 < 200)
00629     mDcand = 1.8645;
00630   else if (mode1>=200 && mode1 < 400 && mode2>=200 && mode2 < 400)
00631     mDcand = 1.8693;
00632   else if (mode1>=400 && mode1 < 1000 && mode2>=400 && mode2 < 1000)
00633     mDcand = 1.9682;
00634   else{
00635     cout<<"double tag modes are not from same particle ! "<<endl;
00636     return false;
00637   }
00638   
00639   
00640   vector<int> igood1, igood2;
00641   igood1.clear(),igood2.clear();
00642   int index=0;
00643   EvtRecDTagCol::iterator iter_dtag=m_iterbegin;
00644 
00645   for ( ; iter_dtag != m_iterend; iter_dtag++){
00646     int iter_mode=(*iter_dtag)->decayMode();
00647     int iter_charm=(*iter_dtag)->charm();
00648     int iter_type=(*iter_dtag)->type();
00649 
00650     if(m_pid){
00651       if( iter_mode == mode1 && iter_charm == tagcharm1 && iter_type==1 )
00652         igood1.push_back(index);
00653       
00654       if( iter_mode == mode2 && iter_charm == tagcharm2 && iter_type==1)
00655         igood2.push_back(index);
00656     }
00657     else{
00658       if( iter_mode == mode1 && iter_charm == tagcharm1)
00659         igood1.push_back(index);
00660       
00661       if( iter_mode == mode2 && iter_charm == tagcharm2)
00662         igood2.push_back(index);
00663     }
00664 
00665   
00666     index++;
00667   }
00668   
00669   //look for the best pair of double-tagged event
00670 
00671   bool isDtcand=false;
00672   double deltaM=1.00;
00673   int index_i=0, index_j=0;
00674   EvtRecDTagCol::iterator iter_i, iter_j;
00675   
00676   for(int i=0; i<igood1.size(); i++){
00677   
00678     iter_i=m_iterbegin+igood1[i];
00679     int charm_i=(*iter_i)->charm();
00680     for(int j=0;j<igood2.size();j++){
00681       iter_j=m_iterbegin+igood2[j];
00682       int charm_j=(*iter_j)->charm();
00683       if( charm_i*charm_j>0 || igood2[j] == igood1[i] ) continue;
00684       
00685       if(shareTracks(iter_i,iter_j)) continue;
00686 
00687       m_viterdtag1.push_back(m_iterbegin+igood1[i]);
00688       m_viterdtag2.push_back(m_iterbegin+igood2[j]);      
00689 
00690     } //end of j loop
00691   } //end of i loop
00692 
00693   if(m_viterdtag1.size()>0)
00694     isDtcand=true;
00695   
00696 
00697   return isDtcand;
00698 
00699 } //end of findADtag 

bool DTagTool::findADTag ( int  mode1,
int  mode2 
)

Definition at line 528 of file DTagTool.cxx.

References genRecEmupikp::i, ganga-rec::j, m_iterbegin, m_iterend, m_pid, m_viterdtag1, m_viterdtag2, and shareTracks().

00528                                             {
00529   
00530   int tagcharm1= (mode1<10 || mode1>=200)?+1:0;
00531   int tagcharm2= (mode2<10 || mode2>=200)?-1:0;
00532     
00533   if(tagcharm1*tagcharm2>0){
00534     cout<<"double tagging warning! two  modes can't have same nonzero charmness"<<endl; 
00535     return false;
00536   }
00537   
00538   //define D candidate mass
00539   double mDcand=0;
00540   if( mode1 < 200 && mode2 < 200)
00541     mDcand = 1.8645;
00542   else if ( mode1>=200 && mode1 < 400 && mode2>=200 && mode2 < 400)
00543     mDcand = 1.8693;
00544   else if ( mode1>=400 && mode1 < 1000 && mode2>=400 && mode2 < 1000)
00545     mDcand = 1.9682;
00546   else{
00547     cout<<"double tag modes are not from same particle ! "<<endl;
00548     return false;
00549   }
00550   
00551   
00552   vector<int> igood1, igood2;
00553   igood1.clear(),igood2.clear();
00554   int index=0;
00555   EvtRecDTagCol::iterator iter_dtag=m_iterbegin;
00556 
00557   //charge conjucation considered
00558   for ( ; iter_dtag != m_iterend; iter_dtag++){
00559     int iter_mode=(*iter_dtag)->decayMode();
00560     int iter_charm=(*iter_dtag)->charm();
00561     int iter_type=(*iter_dtag)->type();
00562 
00563     if(m_pid){
00564       if( iter_mode == mode1 && iter_charm == tagcharm1 && iter_type==1 )
00565         igood1.push_back(index);
00566       if( tagcharm1!=0 && iter_mode == mode1 && iter_charm == -tagcharm1 && iter_type==1 )
00567         igood1.push_back(index);
00568       
00569       if( iter_mode == mode2 && iter_charm == tagcharm2 && iter_type==1 )
00570         igood2.push_back(index);
00571       if( tagcharm2!=0 && iter_mode == mode2 && iter_charm == -tagcharm2 && iter_type==1 )
00572         igood2.push_back(index);
00573     }
00574     else{
00575       if( iter_mode == mode1 && iter_charm == tagcharm1 )
00576         igood1.push_back(index);
00577       if( tagcharm1!=0 && iter_mode == mode1 && iter_charm == -tagcharm1 )
00578         igood1.push_back(index);
00579       
00580       if( iter_mode == mode2 && iter_charm == tagcharm2 )
00581         igood2.push_back(index);
00582       if( tagcharm2!=0 && iter_mode == mode2 && iter_charm == -tagcharm2 )
00583         igood2.push_back(index);
00584     }
00585 
00586     index++;
00587   }
00588   
00589   //look for the best pair of double-tagged event
00590 
00591   bool isDtcand=false;
00592   EvtRecDTagCol::iterator iter_i, iter_j;
00593   
00594   for(int i=0; i<igood1.size(); i++){
00595   
00596     iter_i=m_iterbegin+igood1[i];
00597     int charm_i=(*iter_i)->charm();
00598     
00599     for(int j=0;j<igood2.size();j++){
00600       iter_j=m_iterbegin+igood2[j];
00601       int charm_j=(*iter_j)->charm();
00602       if( charm_i*charm_j>0 || igood2[j] == igood1[i] ) continue;
00603       if(shareTracks(iter_i,iter_j)) continue;
00604       
00605       m_viterdtag1.push_back(m_iterbegin+igood1[i]);
00606       m_viterdtag2.push_back(m_iterbegin+igood2[j]);
00607     
00608       
00609     } //end of j loop
00610   } //end of i loop
00611 
00612   if(m_viterdtag1.size()>0){
00613     isDtcand=true;
00614   }
00615   
00616   return isDtcand;
00617 }

bool DTagTool::findADTag ( EvtRecDTag::DecayMode  mode1,
int  tagcharm1,
EvtRecDTag::DecayMode  mode2,
int  tagcharm2 
)

Definition at line 321 of file DTagTool.cxx.

References findADTag().

00321                                                                                                           {
00322   
00323   return findADTag(static_cast<int>(mode1), tagcharm1, static_cast<int>(mode2), tagcharm2);
00324 
00325 } //end of findDtag 

bool DTagTool::findADTag ( EvtRecDTag::DecayMode  mode1,
EvtRecDTag::DecayMode  mode2 
)

Definition at line 315 of file DTagTool.cxx.

Referenced by DDecay::execute(), and findADTag().

00315                                                                             {
00316   
00317   return findADTag(static_cast<int>(mode1), static_cast<int>(mode2));
00318   
00319 }

bool DTagTool::findDTag ( int  mode1,
int  tagcharm1,
int  mode2,
int  tagcharm2,
string  smass = "mbc" 
)

Definition at line 433 of file DTagTool.cxx.

References compare(), count, genRecEmupikp::i, ganga-rec::j, m_iterbegin, m_iterdtag1, m_iterdtag2, m_iterend, m_pid, and shareTracks().

00433                                                                                        {
00434 
00435   if(tagcharm1*tagcharm2>0){
00436     cout<<"double tagging warning! two  modes can't have same nonzero charmness"<<endl; 
00437     return false;
00438   }
00439   
00440   //define D candidate mass
00441   double mDcand=0;
00442   if( mode1 < 200 && mode2 < 200)
00443     mDcand = 1.8645;
00444   else if (mode1>=200 && mode1 < 400 && mode2>=200 && mode2 < 400)
00445     mDcand = 1.8693;
00446   else if (mode1>=400 && mode1 < 1000 && mode2>=400 && mode2 < 1000)
00447     mDcand = 1.9682;
00448   else{
00449     cout<<"double tag modes are not from same particle ! "<<endl;
00450     return false;
00451   }
00452   
00453   
00454   vector<int> igood1, igood2;
00455   igood1.clear(),igood2.clear();
00456   int index=0;
00457   EvtRecDTagCol::iterator iter_dtag=m_iterbegin;
00458 
00459   for ( ; iter_dtag != m_iterend; iter_dtag++){
00460     int iter_mode=(*iter_dtag)->decayMode();
00461     int iter_charm=(*iter_dtag)->charm();
00462     int iter_type=(*iter_dtag)->type();
00463 
00464     if(m_pid){
00465       if( iter_mode == mode1 && iter_charm == tagcharm1 && iter_type==1 )
00466         igood1.push_back(index);
00467       
00468       if( iter_mode == mode2 && iter_charm == tagcharm2 && iter_type==1)
00469         igood2.push_back(index);
00470     }
00471     else{
00472       if( iter_mode == mode1 && iter_charm == tagcharm1)
00473         igood1.push_back(index);
00474       
00475       if( iter_mode == mode2 && iter_charm == tagcharm2)
00476         igood2.push_back(index);
00477     }
00478 
00479   
00480     index++;
00481   }
00482   
00483   //look for the best pair of double-tagged event
00484 
00485   if(igood1.size()<1 || igood2.size()<1)
00486     return false;
00487 
00488   bool isDtcand=false;
00489   int index_i=0, index_j=0;
00490   
00491   
00492 
00493 
00494   EvtRecDTagCol::iterator iter_i, iter_j;
00495   int count=0;
00496   for(int i=0; i<igood1.size(); i++){
00497   
00498     iter_i=m_iterbegin+igood1[i];
00499     int charm_i=(*iter_i)->charm();
00500     for(int j=0;j<igood2.size();j++){
00501       iter_j=m_iterbegin+igood2[j];
00502       int charm_j=(*iter_j)->charm();
00503       if( charm_i*charm_j>0 || igood2[j] == igood1[i] ) continue;
00504       
00505       if(shareTracks(iter_i,iter_j)) continue;
00506       count++;
00507       if(count==1){
00508         m_iterdtag1=iter_i;
00509         m_iterdtag2=iter_j;
00510       }
00511       
00512       if( compare(iter_i,iter_j,m_iterdtag1,m_iterdtag2,mDcand,smass) ){
00513         m_iterdtag1=iter_i;
00514         m_iterdtag2=iter_j;
00515         isDtcand = true;
00516       }
00517 
00518 
00519     } //end of j loop
00520   } //end of i loop
00521   
00522 
00523   return isDtcand;
00524 
00525 } //end of findDtag 

bool DTagTool::findDTag ( int  mode1,
int  mode2,
string  smass = "mbc" 
)

Definition at line 331 of file DTagTool.cxx.

References compare(), count, genRecEmupikp::i, ganga-rec::j, m_iterbegin, m_iterdtag1, m_iterdtag2, m_iterend, m_pid, and shareTracks().

00331                                                          {
00332   
00333   int tagcharm1= (mode1<10 || mode1>=200)?+1:0;
00334   int tagcharm2= (mode2<10 || mode2>=200)?-1:0;
00335     
00336   if(tagcharm1*tagcharm2>0){
00337     cout<<"double tagging warning! two  modes can't have same nonzero charmness"<<endl; 
00338     return false;
00339   }
00340   
00341   //define D candidate mass
00342   double mDcand=0;
00343   if( mode1 < 200 && mode2 < 200)
00344     mDcand = 1.8645;
00345   else if ( mode1>=200 && mode1 < 400 && mode2>=200 && mode2 < 400)
00346     mDcand = 1.8693;
00347   else if ( mode1>=400 && mode1 < 1000 && mode2>=400 && mode2 < 1000)
00348     mDcand = 1.9682;
00349   else{
00350     cout<<"double tag modes are not from same particle ! "<<endl;
00351     return false;
00352   }
00353   
00354   
00355   vector<int> igood1, igood2;
00356   igood1.clear(),igood2.clear();
00357   int index=0;
00358   EvtRecDTagCol::iterator iter_dtag=m_iterbegin;
00359 
00360   //charge conjucation considered
00361   for ( ; iter_dtag != m_iterend; iter_dtag++){
00362     int iter_mode=(*iter_dtag)->decayMode();
00363     int iter_charm=(*iter_dtag)->charm();
00364     int iter_type=(*iter_dtag)->type();
00365 
00366     if(m_pid){
00367       if( iter_mode == mode1 && iter_charm == tagcharm1 && iter_type==1 )
00368         igood1.push_back(index);
00369       if( tagcharm1!=0 && iter_mode == mode1 && iter_charm == -tagcharm1 && iter_type==1 )
00370         igood1.push_back(index);
00371       
00372       if( iter_mode == mode2 && iter_charm == tagcharm2 && iter_type==1 )
00373         igood2.push_back(index);
00374       if( tagcharm2!=0 && iter_mode == mode2 && iter_charm == -tagcharm2 && iter_type==1 )
00375         igood2.push_back(index);
00376     }
00377     else{
00378       if( iter_mode == mode1 && iter_charm == tagcharm1 )
00379         igood1.push_back(index);
00380       if( tagcharm1!=0 && iter_mode == mode1 && iter_charm == -tagcharm1 )
00381         igood1.push_back(index);
00382       
00383       if( iter_mode == mode2 && iter_charm == tagcharm2 )
00384         igood2.push_back(index);
00385       if( tagcharm2!=0 && iter_mode == mode2 && iter_charm == -tagcharm2 )
00386         igood2.push_back(index);
00387     }
00388 
00389     index++;
00390   }
00391   
00392   //look for the best pair of double-tagged event
00393   if(igood1.size()<1 || igood2.size()<1)
00394     return false;
00395 
00396   bool isDtcand=false;
00397   int index_i=0, index_j=0;
00398  
00399   EvtRecDTagCol::iterator iter_i, iter_j;
00400   int count=0;
00401   for(int i=0; i<igood1.size(); i++){
00402   
00403     iter_i=m_iterbegin+igood1[i];
00404     
00405     int charm_i=(*iter_i)->charm();
00406     for(int j=0;j<igood2.size();j++){
00407       iter_j=m_iterbegin+igood2[j];
00408       
00409       int charm_j=(*iter_j)->charm();
00410       if( charm_i*charm_j>0 || igood2[j] == igood1[i] ) continue;
00411       
00412       if(shareTracks(iter_i,iter_j)) continue;
00413       count++;
00414       if(count==1){
00415         m_iterdtag1=iter_i;
00416         m_iterdtag2=iter_j;
00417       }
00418       
00419       if( compare(iter_i,iter_j,m_iterdtag1,m_iterdtag2,mDcand,smass) ){
00420         m_iterdtag1=iter_i;
00421         m_iterdtag2=iter_j;
00422         isDtcand = true;
00423       }
00424       
00425     } //end of j loop
00426   } //end of i loop
00427 
00428   
00429   return isDtcand;
00430 }

bool DTagTool::findDTag ( EvtRecDTag::DecayMode  mode1,
int  tagcharm1,
EvtRecDTag::DecayMode  mode2,
int  tagcharm2,
string  smass = "mbc" 
)

Definition at line 307 of file DTagTool.cxx.

References findDTag().

00307                                                                                                                        {
00308   
00309   return findDTag(static_cast<int>(mode1), tagcharm1, static_cast<int>(mode2), tagcharm2, smass);
00310 
00311 } //end of findDtag 

bool DTagTool::findDTag ( EvtRecDTag::DecayMode  mode1,
EvtRecDTag::DecayMode  mode2,
string  smass = "mbc" 
)

Definition at line 301 of file DTagTool.cxx.

Referenced by DDecay::execute(), and findDTag().

00301                                                                                          {
00302   
00303   return findDTag(static_cast<int>(mode1), static_cast<int>(mode2), smass);
00304   
00305 }

bool DTagTool::findSTag ( int  mode  ) 

Definition at line 264 of file DTagTool.cxx.

References m_iterbegin, m_iterend, m_iterstag, and m_pid.

00264                                {
00265 
00266   bool isStcand=false;
00267   double de_min=1;
00268  
00269   //loop over the dtag list
00270   EvtRecDTagCol::iterator iter_dtag=m_iterbegin;
00271   for ( ; iter_dtag != m_iterend; iter_dtag++){
00272  
00273     if(m_pid){
00274       if(  (*iter_dtag)->type()!=1 || (*iter_dtag)->decayMode() != mode ) 
00275         continue;
00276     }
00277     else{
00278       if(  (*iter_dtag)->decayMode() != mode ) 
00279         continue;
00280     }
00281 
00282     if(fabs((*iter_dtag)->deltaE())<fabs(de_min)){
00283       isStcand=true;
00284       m_iterstag=iter_dtag;
00285       de_min=(*iter_dtag)->deltaE();
00286     }
00287  
00288   } //end of looping over the entire DTag list
00289  
00290   return isStcand;
00291  
00292 }//end of stag 

bool DTagTool::findSTag ( int  mode,
int  tagcharm 
)

Definition at line 234 of file DTagTool.cxx.

References m_iterbegin, m_iterend, m_iterstag, and m_pid.

00234                                              {
00235 
00236   bool isStcand=false;
00237   double de_min=1;
00238  
00239   //loop over the dtag list
00240   EvtRecDTagCol::iterator iter_dtag=m_iterbegin;
00241   for ( ; iter_dtag != m_iterend; iter_dtag++){
00242 
00243     if(m_pid){
00244       if( (*iter_dtag)->type()!=1 || (*iter_dtag)->decayMode() != mode ||  (*iter_dtag)->charm() != tagcharm ) 
00245         continue;
00246     }
00247     else{
00248       if( (*iter_dtag)->decayMode() != mode ||  (*iter_dtag)->charm() != tagcharm ) 
00249         continue;
00250     }
00251     if(fabs((*iter_dtag)->deltaE())<fabs(de_min)){
00252       isStcand=true;
00253       m_iterstag=iter_dtag;
00254       de_min=(*iter_dtag)->deltaE();
00255     }
00256  
00257   } //end of looping over the entire DTag list
00258  
00259   return isStcand;
00260  
00261 }//end of stag 

bool DTagTool::findSTag ( EvtRecDTag::DecayMode  mode  ) 

Definition at line 225 of file DTagTool.cxx.

References findSTag().

00225                                                {
00226   return findSTag(static_cast<int>(mode));
00227   
00228 }//end of stag 

bool DTagTool::findSTag ( EvtRecDTag::DecayMode  mode,
int  tagcharm 
)

Definition at line 217 of file DTagTool.cxx.

Referenced by DSemilepAlg::execute(), DDecay::execute(), and findSTag().

00217                                                              {
00218   
00219   return findSTag(static_cast<int>(mode), tagcharm);
00220 
00221 }//end of stag 

bool DTagTool::isDTagListEmpty (  )  [inline]

Definition at line 36 of file DTagTool.h.

References m_isdtaglistempty.

Referenced by DSemilepAlg::execute(), and DDecay::execute().

00036 { return m_isdtaglistempty; }

bool DTagTool::isElectron ( EvtRecTrack trk  ) 

Definition at line 1015 of file DTagTool.cxx.

References ISimplePIDSvc::iselectron(), m_simplePIDSvc, and ISimplePIDSvc::preparePID().

Referenced by cosmicandleptonVeto().

01015                                          {
01016   
01017   m_simplePIDSvc->preparePID(trk);
01018   return ( m_simplePIDSvc->iselectron(true));
01019 
01020   /*
01021 
01022   double dedxchi=-99;
01023   double Eemc=0;
01024   double ptrk=-99;
01025  
01026   if(trk->isMdcDedxValid()){
01027     RecMdcDedx* dedxTrk=trk->mdcDedx();
01028     dedxchi=dedxTrk->chiE();
01029   }
01030    
01031   if( trk->isMdcKalTrackValid() ){
01032     RecMdcKalTrack *mdcKalTrk = trk->mdcKalTrack();
01033     ptrk= mdcKalTrk->p();
01034   }
01035   if( trk->isEmcShowerValid()){
01036     RecEmcShower *emcTrk = trk->emcShower();
01037     Eemc=emcTrk->energy();
01038   }
01039  
01040   double eop = Eemc/ptrk;
01041  
01042   if( fabs(eop)>0.8 && fabs(dedxchi)<5)
01043     return true;
01044   else
01045     return false;
01046   */
01047 }

bool DTagTool::isGoodShower ( EvtRecTrack trk  ) 

Definition at line 1119 of file DTagTool.cxx.

References cos(), EvtRecTrack::emcShower(), DstEmcShower::energy(), EvtRecTrack::isEmcShowerValid(), DstEmcShower::theta(), and DstEmcShower::time().

01119                                            {
01120   if( !(trk->isEmcShowerValid() )) return false;
01121   RecEmcShower *emcTrk = trk->emcShower();
01122   double eraw = emcTrk->energy();
01123   double time = emcTrk->time();
01124   double costh = cos(emcTrk->theta());
01125   if( ( 
01126        (fabs(costh)<0.80 && eraw>0.025) 
01127        || (fabs(costh)>0.86 && eraw>0.05) 
01128        ) && time>0 && time<14 ) 
01129     return true;
01130 
01131   return false;
01132 }

bool DTagTool::isGoodTrack ( EvtRecTrack trk  ) 

Definition at line 1083 of file DTagTool.cxx.

References VFHelix::a(), cos(), RecMdcKalTrack::getZError(), RecMdcKalTrack::getZHelix(), EvtRecTrack::isMdcKalTrackValid(), IVertexDbSvc::isVertexValid(), EvtRecTrack::mdcKalTrack(), DstMdcKalTrack::pion, VFHelix::pivot(), IVertexDbSvc::PrimaryVertex(), DstMdcKalTrack::setPidType(), IVertexDbSvc::SigmaPrimaryVertex(), DstMdcKalTrack::theta(), and vec.

Referenced by cosmicandleptonVeto().

01083                                           {
01084   
01085   if( !trk->isMdcKalTrackValid()) {
01086     return false;
01087   }
01088 
01089   Hep3Vector xorigin(0,0,0);
01090   IVertexDbSvc*  vtxsvc;
01091   Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
01092   if(vtxsvc->isVertexValid()){
01093     double* dbv = vtxsvc->PrimaryVertex();
01094     double*  vv = vtxsvc->SigmaPrimaryVertex();
01095     xorigin.setX(dbv[0]);
01096     xorigin.setY(dbv[1]);
01097     xorigin.setZ(dbv[2]);
01098   }
01099   
01100   
01101   RecMdcKalTrack *mdcKalTrk = trk->mdcKalTrack();
01102   mdcKalTrk->setPidType(RecMdcKalTrack::pion);
01103   HepVector    a  = mdcKalTrk->getZHelix();
01104   HepSymMatrix Ea = mdcKalTrk->getZError();
01105   HepPoint3D pivot(0.,0.,0.);
01106   HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
01107   VFHelix helixp(pivot,a,Ea);
01108   helixp.pivot(IP);
01109   HepVector vec    = helixp.a();
01110   double    vrl    = vec[0];
01111   double    vzl    = vec[3];
01112   double costheta  = cos(mdcKalTrk->theta());
01113   
01114   if(fabs(vrl)<1 && fabs(vzl)<10 && fabs(costheta)<0.93)
01115     return true;
01116   return false;
01117 }

bool DTagTool::isKaon ( EvtRecTrack trk  ) 

Definition at line 1000 of file DTagTool.cxx.

References genRecEmupikp::i, and EvtRecTrack::trackId().

Referenced by DDecay::execute().

01000                                      {
01001   SmartRefVector<EvtRecTrack> kaonid=(*m_iterbegin)->kaonId();
01002 
01003   for(int i=0; i < kaonid.size() ;i++){
01004     if( trk->trackId() == kaonid[i]->trackId()){
01005       return true;
01006       break;
01007     }
01008   }
01009  
01010   return false;
01011 }

bool DTagTool::isMuon ( EvtRecTrack trk  ) 

Definition at line 1049 of file DTagTool.cxx.

References DstMdcDedx::chiMu(), DstMucTrack::depth(), EvtRecTrack::emcShower(), DstEmcShower::energy(), EvtRecTrack::isEmcShowerValid(), EvtRecTrack::isMdcDedxValid(), EvtRecTrack::isMdcKalTrackValid(), EvtRecTrack::isMucTrackValid(), EvtRecTrack::mdcDedx(), EvtRecTrack::mdcKalTrack(), EvtRecTrack::mucTrack(), and DstMdcKalTrack::p().

Referenced by cosmicandleptonVeto().

01049                                      {
01050   
01051   double depth=-99;
01052 
01053   double dedxchi=-99;
01054   double Eemc=0;
01055   double ptrk=-99;
01056  
01057   if(trk->isMdcDedxValid()){
01058     RecMdcDedx* dedxTrk=trk->mdcDedx();
01059     dedxchi=dedxTrk->chiMu();
01060   }
01061    
01062   if( trk->isMdcKalTrackValid() ){
01063     RecMdcKalTrack *mdcKalTrk = trk->mdcKalTrack();
01064     ptrk= mdcKalTrk->p();
01065   }
01066   if( trk->isEmcShowerValid()){
01067     RecEmcShower *emcTrk = trk->emcShower();
01068     Eemc=emcTrk->energy();
01069   }
01070  
01071   double eop = Eemc/ptrk;
01072 
01073   if(  trk->isMucTrackValid() ){
01074     RecMucTrack* mucTrk=trk->mucTrack();
01075     depth=mucTrk->depth();
01076   }
01077 
01078   if( fabs(dedxchi)<5 && fabs(Eemc)>0.15 && fabs(Eemc)<0.3 && (depth>=80*ptrk-60 || depth>40))
01079     return true;
01080   return false;
01081 }

bool DTagTool::isPion ( EvtRecTrack trk  ) 

Definition at line 985 of file DTagTool.cxx.

References genRecEmupikp::i, and EvtRecTrack::trackId().

Referenced by DDecay::execute().

00985                                      {
00986   
00987   SmartRefVector<EvtRecTrack> pionid=(*m_iterbegin)->pionId();
00988   
00989   for(int i=0; i < pionid.size() ;i++){
00990     if( trk->trackId() == pionid[i]->trackId()){
00991       return true;
00992       break;
00993     }
00994   }
00995   
00996   return false;
00997 }

EvtRecVeeVertexCol::iterator DTagTool::ks_begin (  )  [inline]

Definition at line 47 of file DTagTool.h.

References m_ksiterbegin.

Referenced by DDecay::execute().

00047 { return m_ksiterbegin;}

EvtRecVeeVertexCol::iterator DTagTool::ks_end (  )  [inline]

Definition at line 48 of file DTagTool.h.

References m_ksiterend.

00048 { return m_ksiterend;}

vector< int > DTagTool::ksId ( EvtRecDTagCol::iterator  iter,
int  numks = 1 
)

Definition at line 872 of file DTagTool.cxx.

References genRecEmupikp::i, m_ksiterbegin, m_ksiterend, and EvtRecTrack::trackId().

Referenced by DDecay::execute().

00872                                                                     {
00873   
00874   SmartRefVector<EvtRecTrack> tracks=(*iter_dtag)->tracks();
00875   if(tracks.size()<2*numks){
00876     cout<<"too many kshort required"<<endl;
00877     exit(1);
00878   }
00879   vector<int> canid;
00880   canid.clear();
00881   
00882   if(tracks.size()==0) 
00883     return canid;
00884   
00885 
00886   for(EvtRecVeeVertexCol::iterator ksItr = m_ksiterbegin;
00887       ksItr < m_ksiterend; ksItr++){
00888 
00890     if((*ksItr)->vertexId() != 310) continue;
00891 
00892     EvtRecTrack* aKsChild1Trk = (*ksItr)->daughter(0);
00893     EvtRecTrack* aKsChild2Trk = (*ksItr)->daughter(1);
00894 
00895     int ksChild1TrkId = aKsChild1Trk->trackId();
00896     int ksChild2TrkId = aKsChild2Trk->trackId();
00897    
00898     for(int index=0; index<numks; ++index){
00899       bool isc1id=false;
00900       bool isc2id=false;
00901       
00902       for(int i=index*2; i<index*2+2; ++i){
00903         if(!isc1id && ksChild1TrkId == tracks[i]->trackId())
00904           isc1id=true;
00905         if(!isc2id && ksChild2TrkId == tracks[i]->trackId())
00906           isc2id=true;
00907       }
00908       
00909       if(isc1id && isc2id)
00910         canid.push_back( ksItr - m_ksiterbegin); 
00911     }
00912 
00913     if(canid.size()==numks){
00914       return canid;
00915       break;
00916     }
00917   }  // End "ksItr" FOR Loop
00918   
00919   return canid;
00920 }

vector< int > DTagTool::mode ( int  decaymode  ) 

Definition at line 193 of file DTagTool.cxx.

References iter(), m_iterbegin, m_iterend, m_pid, and mode().

00193                                        {
00194 
00195   vector<int> mode;
00196   int index=0;
00197   for(EvtRecDTagCol::iterator iter=m_iterbegin; iter != m_iterend; iter++){
00198     
00199     if(m_pid){
00200       if( (*iter)->decayMode() == decaymode && (*iter)->type() == 1 )
00201         mode.push_back( index ); 
00202     }
00203     else{
00204       if( (*iter)->decayMode() == decaymode )
00205         mode.push_back( index ); 
00206     }
00207 
00208     index++;
00209   }
00210   
00211   return mode;
00212 }

vector< int > DTagTool::mode ( EvtRecDTag::DecayMode  decaymode  ) 

Definition at line 171 of file DTagTool.cxx.

References iter(), m_iterbegin, m_iterend, and m_pid.

Referenced by DDecay::execute(), and mode().

00171                                                        {
00172 
00173   vector<int> mode;
00174   int index=0;
00175   for(EvtRecDTagCol::iterator iter=m_iterbegin; iter != m_iterend; iter++){
00176     
00177     if(m_pid){
00178       if( (*iter)->decayMode() == decaymode && (*iter)->type() == 1 )
00179         mode.push_back( index ); 
00180     }
00181     else{
00182       if( (*iter)->decayMode() == decaymode )
00183         mode.push_back( index ); 
00184     }
00185 
00186     index++;
00187   }
00188   
00189   return mode;
00190 }

EvtRecDTagCol::iterator DTagTool::modes_begin (  )  [inline]

Definition at line 41 of file DTagTool.h.

References m_iterbegin.

Referenced by DSemilepAlg::execute(), and DDecay::execute().

00041 { return m_iterbegin;}

EvtRecDTagCol::iterator DTagTool::modes_end (  )  [inline]

Definition at line 42 of file DTagTool.h.

References m_iterend.

Referenced by DSemilepAlg::execute(), and DDecay::execute().

00042 { return m_iterend;}

void DTagTool::name (  )  [inline]

Definition at line 107 of file DTagTool.h.

00107 { cout<<" I am the dtag tool"<<endl;}

int DTagTool::numofShowerAboveThreshold ( int  threshold  ) 

int DTagTool::numofShowerAboveThreshold (  ) 

void DTagTool::operator<< ( EvtRecDTagCol::iterator  iter  ) 

Definition at line 708 of file DTagTool.cxx.

00708                                                      {
00709 
00710   cout<<" print mode:"<< (*iter)->decayMode()<<endl;
00711   cout<<"beam energy is:"<< (*iter)->beamE()<<endl;
00712   cout<<"mBC is:"<< (*iter)->mBC()<<endl;
00713   cout<<"deltaE is:"<< (*iter)->deltaE()<<endl;
00714   cout<<"inv mass is:"<< (*iter)->mass()<<endl;
00715   cout<<"charge is:"<< (*iter)->charge()<<endl;
00716   cout<<"charm is:"<< (*iter)->charm()<<endl;
00717   cout<<"num of children is:"<< (*iter)->numOfChildren()<<endl;
00718 
00719   cout<<"found "<< (*iter)->tracks().size()<<" same side tracks."<<endl;
00720   cout<<"found "<< (*iter)->otherTracks().size()<<" other side tracks."<<endl;
00721   cout<<"found "<< (*iter)->showers().size()<<" same side showers."<<endl;
00722   cout<<"found "<< (*iter)->otherShowers().size()<<" other side showers."<<endl;
00723 
00724 } 

HepLorentzVector DTagTool::p4 ( RecMdcKalTrack mdcKalTrack,
int  pid 
)

Definition at line 931 of file DTagTool.cxx.

References cos(), RecMdcKalTrack::getZHelix(), RecMdcKalTrack::getZHelixE(), RecMdcKalTrack::getZHelixK(), RecMdcKalTrack::getZHelixMu(), RecMdcKalTrack::getZHelixP(), mass, phi0, and sin().

Referenced by DDecay::execute(), and p4shower().

00931                                                                  {
00932 
00933   HepVector zhelix;
00934   double mass=0;
00935   
00936   if(pid==0){
00937     zhelix=mdcKalTrack->getZHelixE();
00938     mass=0.000511;
00939   }
00940   else if(pid==1){
00941     zhelix=mdcKalTrack->getZHelixMu();
00942     mass= 0.105658;
00943   }
00944   else if(pid==2){
00945     zhelix=mdcKalTrack->getZHelix();
00946     mass=0.139570;
00947   }
00948   else if(pid==3){
00949     zhelix=mdcKalTrack->getZHelixK();
00950     mass= 0.493677;
00951   }
00952   else{
00953     zhelix=mdcKalTrack->getZHelixP();
00954     mass= 0.938272;
00955   }
00956  
00957   double dr(0),phi0(0),kappa(0),dz(0),tanl(0);
00958   dr=zhelix[0];
00959   phi0=zhelix[1];
00960   kappa=zhelix[2];
00961   dz=zhelix[3];
00962   tanl=zhelix[4];
00963  
00964   int charge=0;
00965 
00966   if (kappa > 0.0000000001)
00967     charge = 1;
00968   else if (kappa < -0.0000000001)
00969     charge = -1;
00970  
00971   double pxy=0;
00972   if(kappa!=0) pxy = 1.0/fabs(kappa);
00973  
00974   double px = pxy * (-sin(phi0));
00975   double py = pxy * cos(phi0);
00976   double pz = pxy * tanl;
00977  
00978   double e  = sqrt( pxy*pxy + pz*pz + mass*mass );
00979  
00980   return HepLorentzVector(px, py, pz, e);
00981 
00982 
00983 }

HepLorentzVector DTagTool::p4shower ( RecEmcShower shower  ) 

Definition at line 922 of file DTagTool.cxx.

References cos(), DstEmcShower::energy(), p4(), DstEmcShower::phi(), sin(), and DstEmcShower::theta().

Referenced by etap4(), and pi0p4().

00922                                                         {
00923 
00924   double Eemc=shower->energy();
00925   double phi=shower->phi();
00926   double theta=shower->theta();
00927   HepLorentzVector p4(Eemc*sin(theta)*cos(phi),Eemc*sin(theta)*sin(phi),Eemc*cos(theta),Eemc);  
00928   return p4;
00929 }

EvtRecPi0Col::iterator DTagTool::pi0_begin (  )  [inline]

Definition at line 43 of file DTagTool.h.

References m_pi0iterbegin.

Referenced by DDecay::execute().

00043 { return m_pi0iterbegin;}

EvtRecPi0Col::iterator DTagTool::pi0_end (  )  [inline]

Definition at line 44 of file DTagTool.h.

References m_pi0iterend.

00044 { return m_pi0iterend;}

vector< int > DTagTool::pi0Id ( EvtRecDTagCol::iterator  iter,
int  numpi0 = 1 
)

Definition at line 772 of file DTagTool.cxx.

References genRecEmupikp::i, m_pi0iterbegin, m_pi0iterend, and EvtRecTrack::trackId().

Referenced by DDecay::execute().

00772                                                                       {
00773   
00774   SmartRefVector<EvtRecTrack> showers=(*iter_dtag)->showers();
00775   if(showers.size()<2*numpi0){
00776     cout<<"too many pi0 required"<<endl;
00777     exit(1);
00778   }
00779    
00780   vector<int> canid;
00781   canid.clear();
00782 
00783   for(EvtRecPi0Col::iterator pi0Itr = m_pi0iterbegin;
00784       pi0Itr < m_pi0iterend; pi0Itr++){
00785     
00787     EvtRecTrack* heGammaTrk = const_cast<EvtRecTrack*>((*pi0Itr)->hiEnGamma());
00788     EvtRecTrack* leGammaTrk = const_cast<EvtRecTrack*>((*pi0Itr)->loEnGamma());
00789 
00790     int heGammaTrkId = heGammaTrk->trackId();
00791     int leGammaTrkId = leGammaTrk->trackId();
00792     
00793     for(int index=0; index<numpi0; ++index){
00794       bool isheid=false;
00795       bool isleid=false;
00796       
00797       for(int i=index*2; i<index*2+2; ++i){
00798         
00799         if(!isheid && heGammaTrkId == showers[i]->trackId())
00800           isheid=true;
00801         if(!isleid && leGammaTrkId == showers[i]->trackId())
00802           isleid=true;
00803       }
00804       
00805       if(isheid && isleid)
00806         canid.push_back( pi0Itr - m_pi0iterbegin); 
00807     }
00808     
00809 
00810     if(canid.size()==numpi0){
00811       return canid;
00812       break;
00813     }
00814 
00815   }  // End "pi0Itr" FOR Loop
00816 
00817   return canid;
00818   
00819 }

HepLorentzVector DTagTool::pi0p4 ( EvtRecPi0Col::iterator  pi0Itr,
bool  isconstrain = true 
)

Definition at line 726 of file DTagTool.cxx.

References p4shower().

00726                                                                              {
00727 
00728 
00729   if(isconstrain){
00730     HepLorentzVector p41= (*pi0Itr)->hiPfit();
00731     HepLorentzVector p42= (*pi0Itr)->loPfit();
00732     return (p41+p42);
00733   }
00734   else {
00735     EvtRecTrack* trk1 = const_cast<EvtRecTrack*>((*pi0Itr)->hiEnGamma());
00736     EvtRecTrack* trk2 = const_cast<EvtRecTrack*>((*pi0Itr)->loEnGamma());
00737     
00738     RecEmcShower* emctrk1 = (trk1)->emcShower();
00739     RecEmcShower* emctrk2 = (trk2)->emcShower();
00740     
00741     HepLorentzVector p41=p4shower(emctrk1);
00742     HepLorentzVector p42=p4shower(emctrk2);
00743     return (p41+p42);
00744   }  
00745   
00746 }

void DTagTool::setdtagDE ( double  sigma1,
double  sigma2 
) [inline]

Definition at line 80 of file DTagTool.h.

References m_tag1desigma, and m_tag2desigma.

00080 { m_tag1desigma=sigma1;m_tag2desigma=sigma2;}

void DTagTool::setPID ( bool  pid  )  [inline]

Definition at line 37 of file DTagTool.h.

References m_pid.

00037 {m_pid = pid;}

bool DTagTool::shareTracks ( EvtRecDTagCol::iterator  iter1,
EvtRecDTagCol::iterator  iter2 
)

Definition at line 1232 of file DTagTool.cxx.

References genRecEmupikp::i, and ganga-rec::j.

Referenced by findADTag(), and findDTag().

01232                                                                                  {
01233   
01234   SmartRefVector<EvtRecTrack> tracks1=(*iter1)->tracks();
01235   SmartRefVector<EvtRecTrack> showers1=(*iter1)->showers();
01236   SmartRefVector<EvtRecTrack> tracks2=(*iter2)->tracks();
01237   SmartRefVector<EvtRecTrack> showers2=(*iter2)->showers();
01238   
01239   //charged tracks
01240   for(int i=0; i<tracks1.size(); i++){
01241     for(int j=0; j<tracks2.size(); j++){
01242       if(tracks1[i]==tracks2[j])
01243         return true;
01244     }
01245   }
01246 
01247   //neutral showers
01248   for(int i=0; i<showers1.size(); i++){
01249     for(int j=0; j<showers2.size(); j++){
01250       if(showers1[i]==showers2[j])
01251         return true;
01252     }
01253   }  
01254 
01255   return false;
01256 }

EvtRecDTagCol::iterator DTagTool::stag (  )  [inline]

Definition at line 75 of file DTagTool.h.

References m_iterstag.

Referenced by DSemilepAlg::execute(), and DDecay::execute().

00075 { return m_iterstag;}

vector<EvtRecDTagCol::iterator> DTagTool::vdtag1 (  )  [inline]

Definition at line 78 of file DTagTool.h.

References m_viterdtag1.

Referenced by DDecay::execute().

00078 { return m_viterdtag1;}

vector<EvtRecDTagCol::iterator> DTagTool::vdtag2 (  )  [inline]

Definition at line 79 of file DTagTool.h.

References m_viterdtag2.

Referenced by DDecay::execute().

00079 { return m_viterdtag2;}


Member Data Documentation

EvtRecTrackIterator DTagTool::m_chargebegin [private]

Definition at line 147 of file DTagTool.h.

Referenced by cosmicandleptonVeto(), and DTagTool().

EvtRecTrackIterator DTagTool::m_chargeend [private]

Definition at line 148 of file DTagTool.h.

Referenced by cosmicandleptonVeto(), and DTagTool().

vector<int> DTagTool::m_d0modes [private]

Definition at line 143 of file DTagTool.h.

Referenced by clear(), D0modes(), DTagTool(), and ~DTagTool().

vector<int> DTagTool::m_dpmodes [private]

Definition at line 144 of file DTagTool.h.

Referenced by clear(), Dpmodes(), DTagTool(), and ~DTagTool().

vector<int> DTagTool::m_dsmodes [private]

Definition at line 145 of file DTagTool.h.

Referenced by clear(), Dsmodes(), DTagTool(), and ~DTagTool().

EvtRecEtaToGGCol::iterator DTagTool::m_etaiterbegin [private]

Definition at line 127 of file DTagTool.h.

Referenced by DTagTool(), eta_begin(), and etaId().

EvtRecEtaToGGCol::iterator DTagTool::m_etaiterend [private]

Definition at line 128 of file DTagTool.h.

Referenced by DTagTool(), eta_end(), and etaId().

IDataProviderSvc* DTagTool::m_evtSvc [private]

Definition at line 118 of file DTagTool.h.

Referenced by eventSvc().

bool DTagTool::m_isdtaglistempty [private]

Definition at line 116 of file DTagTool.h.

Referenced by DTagTool(), and isDTagListEmpty().

EvtRecDTagCol::iterator DTagTool::m_iterbegin [private]

Definition at line 123 of file DTagTool.h.

Referenced by DTagTool(), findADTag(), findDTag(), findSTag(), mode(), and modes_begin().

EvtRecDTagCol::iterator DTagTool::m_iterdtag1 [private]

Definition at line 136 of file DTagTool.h.

Referenced by dtag1(), and findDTag().

EvtRecDTagCol::iterator DTagTool::m_iterdtag2 [private]

Definition at line 137 of file DTagTool.h.

Referenced by dtag2(), and findDTag().

EvtRecDTagCol::iterator DTagTool::m_iterend [private]

Definition at line 124 of file DTagTool.h.

Referenced by DTagTool(), findADTag(), findDTag(), findSTag(), mode(), and modes_end().

EvtRecDTagCol::iterator DTagTool::m_iterstag [private]

Definition at line 135 of file DTagTool.h.

Referenced by findSTag(), and stag().

EvtRecVeeVertexCol::iterator DTagTool::m_ksiterbegin [private]

Definition at line 129 of file DTagTool.h.

Referenced by DTagTool(), ks_begin(), and ksId().

EvtRecVeeVertexCol::iterator DTagTool::m_ksiterend [private]

Definition at line 130 of file DTagTool.h.

Referenced by DTagTool(), ks_end(), and ksId().

EvtRecPi0Col::iterator DTagTool::m_pi0iterbegin [private]

Definition at line 125 of file DTagTool.h.

Referenced by DTagTool(), pi0_begin(), and pi0Id().

EvtRecPi0Col::iterator DTagTool::m_pi0iterend [private]

Definition at line 126 of file DTagTool.h.

Referenced by DTagTool(), pi0_end(), and pi0Id().

bool DTagTool::m_pid [private]

Definition at line 133 of file DTagTool.h.

Referenced by DTagTool(), findADTag(), findDTag(), findSTag(), mode(), and setPID().

EvtRecTrackIterator DTagTool::m_showerbegin [private]

Definition at line 149 of file DTagTool.h.

Referenced by cosmicandleptonVeto(), and DTagTool().

EvtRecTrackIterator DTagTool::m_showerend [private]

Definition at line 150 of file DTagTool.h.

Referenced by cosmicandleptonVeto(), and DTagTool().

ISimplePIDSvc* DTagTool::m_simplePIDSvc [private]

Definition at line 119 of file DTagTool.h.

Referenced by DTagTool(), and isElectron().

double DTagTool::m_tag1desigma [private]

Definition at line 140 of file DTagTool.h.

Referenced by compare(), and setdtagDE().

double DTagTool::m_tag2desigma [private]

Definition at line 141 of file DTagTool.h.

Referenced by compare(), and setdtagDE().

vector<EvtRecDTagCol::iterator> DTagTool::m_viterdtag1 [private]

Definition at line 138 of file DTagTool.h.

Referenced by findADTag(), and vdtag1().

vector<EvtRecDTagCol::iterator> DTagTool::m_viterdtag2 [private]

Definition at line 139 of file DTagTool.h.

Referenced by findADTag(), and vdtag2().


Generated on Tue Nov 29 23:18:35 2016 for BOSS_7.0.2 by  doxygen 1.4.7