EFSectorHits Class Reference

#include <EFSectorHits.h>

Inheritance diagram for EFSectorHits:

IEFAlgorithm List of all members.

Public Member Functions

 EFSectorHits (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~EFSectorHits ()
virtual StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()
void reset ()

Protected Attributes

int m_output
float m_beam
PropertyMgr m_propMgr
bool m_run
HltStoreSvcm_HltStoreSvc
IRawDataProviderSvcm_rawDigiSvc
EFResultm_ef

Private Member Functions

bool WhetherSector (float, float=0., float=6.2831852)

Private Attributes

CriteriaItemValuem_nsec

Static Private Attributes

static int idmax [43]

Detailed Description

Definition at line 13 of file EFSectorHits.h.


Constructor & Destructor Documentation

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

Definition at line 21 of file EFSectorHits.cxx.

References m_nsec, IEFAlgorithm::m_output, msgSvc(), and output.

00021                                                                           :
00022   IEFAlgorithm(name, pSvcLocator) {
00023   int output= (m_output%1000)/100;
00024   //declareProperty("OutputLevel",m_output = MSG::NIL);
00025   MsgStream log(msgSvc(), name);
00026   msgSvc()->setOutputLevel(name,output);
00027   m_nsec = new CriteriaItemValue;
00028 }

EFSectorHits::~EFSectorHits (  )  [virtual]

Definition at line 30 of file EFSectorHits.cxx.

References m_nsec.

00030                             {
00031   delete m_nsec;
00032 }


Member Function Documentation

StatusCode EFSectorHits::execute (  ) 

Definition at line 51 of file EFSectorHits.cxx.

References EFResult::addToEFVec(), calibUtil::ERROR, Bes_Common::FATAL, HltStoreSvc::get(), EFResult::getEFVec(), CriteriaItemValue::getValue(), idmax, Bes_Common::INFO, iter(), MdcID::layer(), IEFAlgorithm::m_ef, IEFAlgorithm::m_HltStoreSvc, m_nsec, IEFAlgorithm::m_run, max, min, msgSvc(), phi1, phi2, CriteriaItemValue::setValue(), EFResult::setVecBit(), Bes_Common::WARNING, WhetherSector(), and MdcID::wire().

00051                                  {
00052   
00053   //reset();
00054   MsgStream log(msgSvc(), name());
00055   int32_t nshower=m_ef->getEFVec(38);
00056   if(nshower<2)  return StatusCode::SUCCESS;
00057 
00058   //DataObject*  pObject;
00059  
00060   // Part 1: Get the event header, print out event and run number
00061   SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
00062   if (!eventHeader) {
00063     log << MSG::FATAL << "Could not find Event Header" << endreq;
00064     return( StatusCode::FAILURE);
00065   }
00066   //Part 2: Retrieve Hits Collection 
00067   SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc(),"/Event/Digi/MdcDigiCol");
00068   if (!mdcDigiCol) {
00069     log << MSG::FATAL << "EmcRec could not find Mdc digi!!" << endreq;
00070     return( StatusCode::FAILURE);
00071   }
00072   //Part 3: Get information of hits
00073   unsigned int nsec=0;
00074   Identifier id;
00075   MdcDigiCol::iterator iter=mdcDigiCol->begin();
00076 
00077   CriteriaItemValue* p1;
00078   CriteriaItemValue* p2;
00079   float              phi1,phi2;
00080   if((!m_HltStoreSvc->get("phi1", p1))||(!m_HltStoreSvc->get("phi2", p2)))return false;
00081   if((!(p1->getValue(phi1)))||(!(p2->getValue(phi2)))) return false;
00082   //phi(-pi,pi)==>(0,2pi)
00083   if(phi1<0) phi1+=6.2831852;
00084   if(phi2<0) phi2+=6.2831852;
00085   //Decide sector (phi11,phi12) and (phi21,phi22)
00086   float phi11=min(phi1,phi2);
00087   float phi22=max(phi1,phi2);
00088   float phi12=(phi11+phi22-3.1415926)*0.5;
00089   float phi21=(phi11+phi22+3.1415926)*0.5;
00090   if(phi12<0.) phi12 += 6.2831852;
00091   if(phi21>6.2831852) phi21 -= 6.2831852;
00092   for(;iter!= mdcDigiCol->end();iter++) {
00093     id=(*iter)->identify();
00094     unsigned int iphi=MdcID::wire(id);
00095     unsigned int ilayer=MdcID::layer(id);
00096     if(ilayer>=43)
00097       log << MSG::ERROR << "MDC(" << ilayer <<","<<iphi <<endreq;
00098     float phi=6.2831853*iphi/idmax[ilayer];
00099     if(WhetherSector(phi,phi11,phi12)||WhetherSector(phi,phi21,phi22)) nsec++;
00100   }
00101   log << MSG::INFO << " Number of hits in sector of MDC is " << nsec <<endreq;
00102   
00103   //Part 4: Put the criteria item(s) to HltStoreSvc here
00104   m_nsec->setValue(nsec);
00105   m_ef->setVecBit(true, 0, 3);
00106   m_ef->addToEFVec(9,37);
00107   if(m_ef->getEFVec(37)!=0) log << MSG::WARNING << "nsec(0) !=0"<< endreq;
00108   m_ef->addToEFVec(nsec,37);
00109 
00110   m_run=1;
00111 
00112   return StatusCode::SUCCESS;
00113 }

StatusCode EFSectorHits::finalize (  ) 

Definition at line 115 of file EFSectorHits.cxx.

References Bes_Common::INFO, and msgSvc().

00115                                   {
00116   MsgStream log(msgSvc(), name());
00117   log << MSG::INFO << "in finalize()" << endmsg;
00118   return StatusCode::SUCCESS;
00119 }

StatusCode EFSectorHits::initialize (  )  [virtual]

Reimplemented from IEFAlgorithm.

Definition at line 34 of file EFSectorHits.cxx.

References calibUtil::ERROR, Bes_Common::INFO, IEFAlgorithm::initialize(), IEFAlgorithm::m_HltStoreSvc, m_nsec, msgSvc(), and HltStoreSvc::put().

00034                                    {
00035 
00036   MsgStream log(msgSvc(), name());
00037   log << MSG::INFO << "in initialize()" << endreq;
00038 
00039   IEFAlgorithm::initialize();
00040 
00041   StatusCode sc;
00042   sc = m_HltStoreSvc->put("nsec", m_nsec);
00043   if ( sc.isFailure() ) {
00044     log << MSG::ERROR << "m_HltStoreSvc->put(nsec) wrong" << endreq;
00045     return sc;
00046   }
00047 
00048   return StatusCode::SUCCESS;
00049 }

void EFSectorHits::reset (  )  [virtual]

Implements IEFAlgorithm.

Definition at line 121 of file EFSectorHits.cxx.

References m_nsec, IEFAlgorithm::m_run, and CriteriaItemValue::reset().

00121                          {
00122 
00123   if(m_run){
00124     m_nsec->reset();
00125     m_run=0;
00126   }
00127   return;
00128 }

bool EFSectorHits::WhetherSector ( float  ,
float  = 0.,
float  = 6.2831852 
) [private]

Definition at line 130 of file EFSectorHits.cxx.

References max, min, phi1, and phi2.

Referenced by execute().

00130                                                             {
00131   float phi1=min(ph1,ph2);
00132   float phi2=max(ph1,ph2);
00133   float delta=0.0610865; //3.5*3.1415926/180.
00134   if((phi2-phi1)<3.1415926){
00135     phi1 -=delta;
00136     phi2 +=delta;
00137     if(phi1<0.) phi1 += 6.2831852;
00138     if(phi2>6.2831852) phi2 -= 6.2831852;
00139     float tmp1=min(phi1,phi2);
00140     float tmp2=max(phi1,phi2);
00141     phi1=tmp1;
00142     phi2=tmp2;
00143   }
00144   else{
00145     phi1 +=delta;
00146     phi2 -=delta;
00147   }
00148   if((phi2-phi1)<3.1415926){
00149     if(ph<=phi2&&ph>=phi1) return true;
00150     else   return false;
00151   }
00152   else{
00153     if(ph>=phi2||ph<=phi1) return true;
00154     else   return false;
00155   }
00156 }


Member Data Documentation

int EFSectorHits::idmax [static, private]

Initial value:

{40,44,48,56,64,72,80,80,76,76,
                             88,88,100,100,112,112,128,128,140,140,
                             160,160,160,160,176,176,176,176,208,208,
                             208,208,240,240,240,240,256,256,256,256,
                             288,288,288}

Definition at line 25 of file EFSectorHits.h.

Referenced by execute().

float IEFAlgorithm::m_beam [protected, inherited]

Definition at line 17 of file IEFAlgorithm.h.

Referenced by EFProcessCluster::execute(), EFGlobalEnergy::execute(), IEFAlgorithm::IEFAlgorithm(), and EFGlobalEnergy::initialize().

EFResult* IEFAlgorithm::m_ef [protected, inherited]

Definition at line 22 of file IEFAlgorithm.h.

Referenced by execute(), EFProcessCluster::execute(), EFGlobalEnergy::execute(), EFFlightTime::execute(), EFDetectorHits::execute(), EFChargedTrack::execute(), and IEFAlgorithm::initialize().

HltStoreSvc* IEFAlgorithm::m_HltStoreSvc [protected, inherited]

Definition at line 20 of file IEFAlgorithm.h.

Referenced by execute(), IEFAlgorithm::initialize(), initialize(), EFProcessCluster::initialize(), EFGlobalEnergy::initialize(), EFFlightTime::initialize(), EFDetectorHits::initialize(), and EFChargedTrack::initialize().

CriteriaItemValue* EFSectorHits::m_nsec [private]

Definition at line 24 of file EFSectorHits.h.

Referenced by EFSectorHits(), execute(), initialize(), reset(), and ~EFSectorHits().

int IEFAlgorithm::m_output [protected, inherited]

Definition at line 16 of file IEFAlgorithm.h.

Referenced by EFChargedTrack::EFChargedTrack(), EFDetectorHits::EFDetectorHits(), EFFlightTime::EFFlightTime(), EFGlobalEnergy::EFGlobalEnergy(), EFProcessCluster::EFProcessCluster(), EFSectorHits(), and IEFAlgorithm::IEFAlgorithm().

PropertyMgr IEFAlgorithm::m_propMgr [protected, inherited]

Definition at line 18 of file IEFAlgorithm.h.

Referenced by IEFAlgorithm::IEFAlgorithm().

IRawDataProviderSvc* IEFAlgorithm::m_rawDigiSvc [protected, inherited]

Definition at line 21 of file IEFAlgorithm.h.

Referenced by EFGlobalEnergy::execute(), EFFlightTime::execute(), EFDetectorHits::execute(), IEFAlgorithm::initialize(), and EFGlobalEnergy::initialize().

bool IEFAlgorithm::m_run [protected, inherited]

Definition at line 19 of file IEFAlgorithm.h.

Referenced by execute(), EFProcessCluster::execute(), EFGlobalEnergy::execute(), EFFlightTime::execute(), EFDetectorHits::execute(), EFChargedTrack::execute(), IEFAlgorithm::initialize(), reset(), EFProcessCluster::reset(), EFGlobalEnergy::reset(), EFFlightTime::reset(), EFDetectorHits::reset(), and EFChargedTrack::reset().


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