Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

EFSectorHits Class Reference

#include <EFSectorHits.h>

Inheritance diagram for EFSectorHits:

IEFAlgorithm IEFAlgorithm List of all members.

Public Member Functions

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

Protected Attributes

float m_beam
EFResultm_ef
EFResultm_ef
HltStoreSvcm_HltStoreSvc
HltStoreSvcm_HltStoreSvc
int m_output
PropertyMgr m_propMgr
IRawDataProviderSvcm_rawDigiSvc
IRawDataProviderSvcm_rawDigiSvc
bool m_run

Private Member Functions

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

Private Attributes

CriteriaItemValuem_nsec
CriteriaItemValuem_nsec

Static Private Attributes

int idmax [43]

Constructor & Destructor Documentation

EFSectorHits::EFSectorHits const std::string &  name,
ISvcLocator *  pSvcLocator
 

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]
 

00030                             {
00031   delete m_nsec;
00032 }

EFSectorHits::EFSectorHits const std::string &  name,
ISvcLocator *  pSvcLocator
 

virtual EFSectorHits::~EFSectorHits  )  [virtual]
 


Member Function Documentation

StatusCode EFSectorHits::execute  ) 
 

StatusCode EFSectorHits::execute  ) 
 

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  ) 
 

StatusCode EFSectorHits::finalize  ) 
 

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

virtual StatusCode EFSectorHits::initialize  )  [virtual]
 

Reimplemented from IEFAlgorithm.

StatusCode EFSectorHits::initialize  )  [virtual]
 

Reimplemented from IEFAlgorithm.

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.

void EFSectorHits::reset  )  [virtual]
 

Implements IEFAlgorithm.

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]
 

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

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}

float IEFAlgorithm::m_beam [protected, inherited]
 

EFResult* IEFAlgorithm::m_ef [protected, inherited]
 

EFResult* IEFAlgorithm::m_ef [protected, inherited]
 

HltStoreSvc* IEFAlgorithm::m_HltStoreSvc [protected, inherited]
 

HltStoreSvc* IEFAlgorithm::m_HltStoreSvc [protected, inherited]
 

CriteriaItemValue* EFSectorHits::m_nsec [private]
 

CriteriaItemValue* EFSectorHits::m_nsec [private]
 

int IEFAlgorithm::m_output [protected, inherited]
 

PropertyMgr IEFAlgorithm::m_propMgr [protected, inherited]
 

IRawDataProviderSvc* IEFAlgorithm::m_rawDigiSvc [protected, inherited]
 

IRawDataProviderSvc* IEFAlgorithm::m_rawDigiSvc [protected, inherited]
 

bool IEFAlgorithm::m_run [protected, inherited]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:00:57 2011 for BOSS6.5.5 by  doxygen 1.3.9.1