Pi0EtaToGGRecAlg Class Reference

#include <Pi0EtaToGGRecAlg.h>

List of all members.

Public Member Functions

 Pi0EtaToGGRecAlg (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()

Private Member Functions

HepLorentzVector getP4 (RecEmcShower *gTrk)
 Functions.
bool validPhoton (EvtRecTrack *recTrk, SmartDataPtr< EvtRecEvent > recEvt, SmartDataPtr< EvtRecTrackCol > recTrkCol)
bool bothInEndcap (HepLorentzVector g1_P4, HepLorentzVector g2_P4)

Private Attributes

bool m_rejectEndEnd
 reject pi0/eta candidate if both photon children are in endcap
double m_pi0minmass_cut
 pi0 cuts
double m_pi0maxmass_cut
double m_pi0chisq_cut
double m_etaminmass_cut
 eta cuts
double m_etamaxmass_cut
double m_etachisq_cut
double m_minEnergy
 Individual photon cuts.
bool m_useBarrelEndcap
double m_maxCosThetaBarrel
double m_minCosThetaEndcap
double m_maxCosThetaEndcap
double m_minEndcapEnergy
bool m_applyTimeCut
double m_minTime
double m_maxTime
double m_deltaTime
bool m_applyDangCut
double m_minDang
int m_maxNGoodPhoton
int m_maxNPi0
bool m_doClear


Detailed Description

Definition at line 16 of file Pi0EtaToGGRecAlg.h.


Constructor & Destructor Documentation

Pi0EtaToGGRecAlg::Pi0EtaToGGRecAlg ( const std::string name,
ISvcLocator *  pSvcLocator 
)

Definition at line 15 of file Pi0EtaToGGRecAlg.cxx.

References m_minEnergy.

00015                                                                                   :
00016    Algorithm(name, pSvcLocator)
00017 {
00018    //Declare the properties
00019    declareProperty("Pi0MinMass",       m_minmass_cut  = 0.07);
00020    declareProperty("Pi0MaxMass",       m_maxmass_cut  = 0.18);
00021    declareProperty("Pi0ChisqCut",      m_chisq_cut    = 20.0);
00022 
00024    declareProperty("PhotonUseBarrelEmc",    m_useBarrel        = true);
00025    declareProperty("PhotonUseEndcapEmc",    m_useEndcap        = true);
00026    declareProperty("PhotonMinEnergy",       m_minEnergy        = 0.02);
00027    declareProperty("PhotonDeltaAngleCut",   m_angled_cut       = 20.0);
00028    declareProperty("PhotonDeltaThetaCut",   m_thed_cut         = 20.0);
00029    declareProperty("PhotonDeltaPhiCut",     m_phid_cut         = 20.0);
00030 
00031 }


Member Function Documentation

bool Pi0EtaToGGRecAlg::bothInEndcap ( HepLorentzVector  g1_P4,
HepLorentzVector  g2_P4 
) [private]

Definition at line 327 of file Pi0EtaToGGRecAlg.cxx.

References m_maxCosThetaEndcap, and m_minCosThetaEndcap.

00327                                                                                  {
00328 
00329   double g1_CosTheta = g1_P4.vect().cosTheta();
00330   double g2_CosTheta = g2_P4.vect().cosTheta();
00331 
00332   bool g1InEndcap = false;
00333   bool g2InEndcap = false;
00334 
00335   if((fabs(g1_CosTheta) > m_minCosThetaEndcap)
00336      &&(fabs(g1_CosTheta) < m_maxCosThetaEndcap)) g1InEndcap = true;
00337 
00338   if((fabs(g2_CosTheta) > m_minCosThetaEndcap)
00339      &&(fabs(g2_CosTheta) < m_maxCosThetaEndcap)) g2InEndcap = true;
00340 
00341   if(g1InEndcap&&g2InEndcap) return( true );
00342 
00343   return( false );
00344 }

StatusCode Pi0EtaToGGRecAlg::execute (  ) 

Definition at line 44 of file Pi0EtaToGGRecAlg.cxx.

References KinematicFit::AddResonance(), TrackPool::AddTrack(), KinematicFit::BuildVirtualParticle(), KinematicFit::chisq(), calibUtil::ERROR, EventModel::EvtRec::EvtRecEvent, EventModel::EvtRec::EvtRecPi0Col, EventModel::EvtRec::EvtRecTrackCol, KinematicFit::Fit(), getP4(), Bes_Common::INFO, KinematicFit::init(), KinematicFit::instance(), msgSvc(), KinematicFit::pfit(), EvtRecPi0::setChisq(), EvtRecPi0::setHiEnGamma(), EvtRecPi0::setHiPfit(), KinematicFit::setIterNumber(), EvtRecPi0::setLoEnGamma(), EvtRecPi0::setLoPfit(), validPhoton(), and xmpi0.

00044                                      {
00045 
00046    MsgStream log(msgSvc(), name());
00047    log << MSG::INFO << "in execute()" <<endreq;
00048 
00049    // get event header, eventlist and tracklist from TDS
00050    SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
00051    SmartDataPtr<EvtRecEvent> recEvt(eventSvc(), EventModel::EvtRec::EvtRecEvent);
00052    SmartDataPtr<EvtRecTrackCol> recTrkCol(eventSvc(),  EventModel::EvtRec::EvtRecTrackCol);
00053 
00054    bool save2TDS = false;
00055    SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(), EventModel::EvtRec::EvtRecPi0Col);
00056    if ( !recPi0Col ) {
00057       recPi0Col = new EvtRecPi0Col;
00058       save2TDS = true;
00059    }
00060 
00061    KinematicFit * kmfit = KinematicFit::instance();
00062 
00063    //
00064    //  Set up the pi0's list
00065    //
00066    for(int i1 = recEvt->totalCharged(); i1 < (recEvt->totalTracks()-1); i1++) {
00067       EvtRecTrack* g1Trk = *(recTrkCol->begin() + i1);
00068       if ( !validPhoton(g1Trk,recEvt,recTrkCol) ) continue;
00069       RecEmcShower* g1Shower = g1Trk->emcShower();
00070       HepLorentzVector g1P4 = getP4(g1Shower);
00071 
00072       for(int i2 = i1+1; i2 < recEvt->totalTracks(); i2++) {
00073          EvtRecTrack* g2Trk = *(recTrkCol->begin() + i2);
00074          if ( !validPhoton(g2Trk,recEvt,recTrkCol) ) continue;
00075          RecEmcShower* g2Shower = g2Trk->emcShower();
00076          HepLorentzVector g2P4 = getP4(g2Shower);
00077 
00078          HepLorentzVector p2g = g1P4 + g2P4;
00079          if ( p2g.m() < m_minmass_cut ) continue;
00080          if ( p2g.m() > m_maxmass_cut ) continue;
00081 
00083          kmfit->init();
00084          kmfit->setIterNumber(1);
00085          kmfit->AddTrack(0, 0.0, g1Shower);
00086          kmfit->AddTrack(1, 0.0, g2Shower);
00087          kmfit->AddResonance(0, xmpi0, 0, 1);
00088          if ( !kmfit->Fit(0) ) continue;
00089          kmfit->BuildVirtualParticle(0);
00090 
00091          double pi0_chisq = kmfit->chisq(0);
00092          if ( pi0_chisq > m_chisq_cut ) continue;
00093 
00094          double e1 = (kmfit->pfit(0)).e();
00095          double e2 = (kmfit->pfit(1)).e();
00096          HepLorentzVector ppi0 = kmfit->pfit(0) + kmfit->pfit(1);
00097 
00098          EvtRecPi0* recPi0 = new EvtRecPi0();
00099          recPi0->setRawMass(p2g.restMass());
00100          recPi0->setChisq(pi0_chisq);
00101          recPi0->setFcos((e1-e2)/ppi0.rho());
00102 
00103          if ( g1P4.e() >= g2P4.e() ) {
00104             recPi0->setHiPfit(kmfit->pfit(0));
00105             recPi0->setLoPfit(kmfit->pfit(1));
00106             recPi0->setHiEnGamma(g1Trk);
00107             recPi0->setLoEnGamma(g2Trk);
00108          }
00109          else {
00110             recPi0->setHiPfit(kmfit->pfit(1));
00111             recPi0->setLoPfit(kmfit->pfit(0));
00112             recPi0->setHiEnGamma(g2Trk);
00113             recPi0->setLoEnGamma(g1Trk);
00114          }
00115 
00116          std::cout << "p(g1) = " <<  g1P4 << std::endl; 
00117          std::cout << "p(g2) = " <<  g2P4 << std::endl; 
00118          std::cout << "chi2(pi0) = " << pi0_chisq << std::endl; 
00119          std::cout << "m(gg) before fill = " << p2g.restMass() << std::endl << std::endl;
00120 
00121          recPi0Col->push_back(recPi0);
00122       }
00123    }
00124 
00126    recEvt->setNumberOfPi0(recPi0Col->size());
00127 
00128    if ( save2TDS ) {
00129       StatusCode sc = eventSvc()->registerObject(EventModel::EvtRec::EvtRecPi0Col, recPi0Col);
00130       if ( sc.isFailure() ) {
00131          log << MSG::ERROR << "could not register EvtRecPi0Col in TDS" <<endreq;
00132          return StatusCode::FAILURE;
00133       }
00134    }
00135 
00136    return StatusCode::SUCCESS;
00137 }

StatusCode Pi0EtaToGGRecAlg::finalize (  ) 

Definition at line 141 of file Pi0EtaToGGRecAlg.cxx.

References Bes_Common::INFO, and msgSvc().

00141                                       {
00142 
00143    MsgStream log(msgSvc(), name());
00144    log << MSG::INFO << "in finalize()" << endreq;
00145 
00146    return StatusCode::SUCCESS;
00147 }

HepLorentzVector Pi0EtaToGGRecAlg::getP4 ( RecEmcShower gTrk  )  [private]

Functions.

Definition at line 149 of file Pi0EtaToGGRecAlg.cxx.

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

Referenced by execute().

00149                                                           {
00150 
00151    double eraw = gTrk->energy();
00152    double phi =  gTrk->phi();
00153    double the =  gTrk->theta();
00154 
00155    return HepLorentzVector( eraw * sin(the) * cos(phi),
00156                             eraw * sin(the) * sin(phi),
00157                             eraw * cos(the),
00158                             eraw );
00159 }

StatusCode Pi0EtaToGGRecAlg::initialize (  ) 

Definition at line 34 of file Pi0EtaToGGRecAlg.cxx.

References Bes_Common::INFO, and msgSvc().

00034                                         {
00035 
00036    MsgStream log(msgSvc(), name());
00037    log << MSG::INFO << "in initialize()" <<endreq;
00038 
00039    return StatusCode::SUCCESS;
00040 }

bool Pi0EtaToGGRecAlg::validPhoton ( EvtRecTrack recTrk,
SmartDataPtr< EvtRecEvent recEvt,
SmartDataPtr< EvtRecTrackCol recTrkCol 
) [private]

Definition at line 162 of file Pi0EtaToGGRecAlg.cxx.

References DstEmcShower::cellId(), DstExtTrack::emcPosition(), EvtRecTrack::emcShower(), DstExtTrack::emcVolumeNumber(), DstEmcShower::energy(), EvtRecTrack::isEmcShowerValid(), ganga-rec::j, m_minEnergy, pi, DstEmcShower::x(), DstEmcShower::y(), and DstEmcShower::z().

Referenced by execute().

00165 {
00166 
00167   if ( !recTrk->isEmcShowerValid() ) return( false );
00168 
00169   RecEmcShower *emcTrk = recTrk->emcShower();
00170 
00171 
00172   // flag = 1: Barrel = 0,2 : Endcap
00173   int flag =(emcTrk->cellId() & 0x000F0000) >> 16;
00174   if ((flag == 1) && !m_useBarrel) return( false );
00175   if ((flag == 0 || flag == 2) && !m_useEndcap) return( false );
00176 
00177   if ( emcTrk->energy() < m_minEnergy ) return( false );
00178 
00180   Hep3Vector emcpos(emcTrk->x(), emcTrk->y(), emcTrk->z());
00181   if (recEvt->totalCharged() > 0) 
00182   {      
00183     double dthe = 200.;
00184     double dphi = 200.;
00185     double dang1 = 200.; 
00186     for (int j = 0; j < recEvt->totalCharged(); j++) {
00187       EvtRecTrackIterator jtTrk = recTrkCol->begin() + j;
00188       if ( !(*jtTrk)->isExtTrackValid() ) continue;
00189       RecExtTrack* extTrk = (*jtTrk)->extTrack();
00190       if ( extTrk->emcVolumeNumber() == -1 ) continue;
00191       Hep3Vector extpos = extTrk->emcPosition();
00192       double  angd1 = extpos.angle(emcpos);
00193       double  thed = extpos.theta() - emcpos.theta();
00194       double  phid = extpos.deltaPhi(emcpos);
00195       thed = fmod(thed+CLHEP::twopi+CLHEP::twopi+CLHEP::pi, CLHEP::twopi) - CLHEP::pi;
00196       phid = fmod(phid+CLHEP::twopi+CLHEP::twopi+CLHEP::pi, CLHEP::twopi) - CLHEP::pi;
00197 
00198       if ( fabs(thed) < fabs(dthe) ) dthe = thed;
00199       if ( fabs(phid) < fabs(dphi) ) dphi = phid;
00200       if ( angd1 < dang1 ) dang1 = angd1;
00201     }
00202     if ( dang1 < 200 ) {
00203       dthe = dthe * 180 / (CLHEP::pi);
00204       dphi = dphi * 180 / (CLHEP::pi);
00205       dang1 = dang1 * 180 / (CLHEP::pi);
00206       if ( m_angled_cut > 0 ) {
00207         if ( dang1 < m_angled_cut ) return( false );
00208       } else {
00209         if ( (fabs(dthe) < m_thed_cut) && (fabs(dphi)<m_phid_cut) ) return( false );
00210       }
00211     }  // End of "dang1 < 200" IF 
00212 
00213   }  // End of "recEvt->totalCharged() > 0" IF
00214 
00215   return true;
00216 }


Member Data Documentation

bool Pi0EtaToGGRecAlg::m_applyDangCut [private]

Definition at line 69 of file Pi0EtaToGGRecAlg.h.

bool Pi0EtaToGGRecAlg::m_applyTimeCut [private]

Definition at line 64 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_deltaTime [private]

Definition at line 67 of file Pi0EtaToGGRecAlg.h.

bool Pi0EtaToGGRecAlg::m_doClear [private]

Definition at line 76 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_etachisq_cut [private]

Definition at line 53 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_etamaxmass_cut [private]

Definition at line 52 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_etaminmass_cut [private]

eta cuts

Definition at line 51 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_maxCosThetaBarrel [private]

Definition at line 59 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_maxCosThetaEndcap [private]

Definition at line 61 of file Pi0EtaToGGRecAlg.h.

Referenced by bothInEndcap().

int Pi0EtaToGGRecAlg::m_maxNGoodPhoton [private]

Definition at line 72 of file Pi0EtaToGGRecAlg.h.

int Pi0EtaToGGRecAlg::m_maxNPi0 [private]

Definition at line 73 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_maxTime [private]

Definition at line 66 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_minCosThetaEndcap [private]

Definition at line 60 of file Pi0EtaToGGRecAlg.h.

Referenced by bothInEndcap().

double Pi0EtaToGGRecAlg::m_minDang [private]

Definition at line 70 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_minEndcapEnergy [private]

Definition at line 62 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_minEnergy [private]

Individual photon cuts.

Definition at line 56 of file Pi0EtaToGGRecAlg.h.

Referenced by Pi0EtaToGGRecAlg(), and validPhoton().

double Pi0EtaToGGRecAlg::m_minTime [private]

Definition at line 65 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_pi0chisq_cut [private]

Definition at line 48 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_pi0maxmass_cut [private]

Definition at line 47 of file Pi0EtaToGGRecAlg.h.

double Pi0EtaToGGRecAlg::m_pi0minmass_cut [private]

pi0 cuts

Definition at line 46 of file Pi0EtaToGGRecAlg.h.

bool Pi0EtaToGGRecAlg::m_rejectEndEnd [private]

reject pi0/eta candidate if both photon children are in endcap

Definition at line 43 of file Pi0EtaToGGRecAlg.h.

bool Pi0EtaToGGRecAlg::m_useBarrelEndcap [private]

Definition at line 58 of file Pi0EtaToGGRecAlg.h.


Generated on Tue Nov 29 23:20:40 2016 for BOSS_7.0.2 by  doxygen 1.4.7