#include <EFProcessCluster.h>
Inheritance diagram for EFProcessCluster:
Public Member Functions | |
EFProcessCluster (const std::string &name, ISvcLocator *pSvcLocator) | |
virtual | ~EFProcessCluster () |
virtual StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
void | reset () |
Protected Attributes | |
int | m_output |
float | m_beam |
PropertyMgr | m_propMgr |
bool | m_run |
HltStoreSvc * | m_HltStoreSvc |
IRawDataProviderSvc * | m_rawDigiSvc |
EFResult * | m_ef |
Private Attributes | |
CriteriaItemValue * | m_nshower |
CriteriaItemValue * | m_acop |
CriteriaItemValue * | m_acole |
CriteriaItemValue * | m_emax1 |
CriteriaItemValue * | m_emax2 |
CriteriaItemValue * | m_emax3 |
CriteriaItemValue * | m_emax12 |
CriteriaItemValue * | m_coste1 |
CriteriaItemValue * | m_coste2 |
CriteriaItemValue * | m_coste3 |
CriteriaItemValue * | m_phi1 |
CriteriaItemValue * | m_phi2 |
CriteriaItemValue * | m_phi3 |
Definition at line 14 of file EFProcessCluster.h.
EFProcessCluster::EFProcessCluster | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 12 of file EFProcessCluster.cxx.
References m_acole, m_acop, m_coste1, m_coste2, m_coste3, m_emax1, m_emax12, m_emax2, m_emax3, m_nshower, IEFAlgorithm::m_output, m_phi1, m_phi2, m_phi3, msgSvc(), and output.
00012 : 00013 IEFAlgorithm(name, pSvcLocator) { 00014 int output=(m_output%10000)/1000; 00015 //declareProperty("OutputLevel",m_output = MSG::NIL); 00016 MsgStream log(msgSvc(), name); 00017 msgSvc()->setOutputLevel(name,output); 00018 m_nshower = new CriteriaItemValue; 00019 m_acop = new CriteriaItemValue; 00020 m_acole = new CriteriaItemValue; 00021 m_emax1 = new CriteriaItemValue; 00022 m_emax2 = new CriteriaItemValue; 00023 m_emax3 = new CriteriaItemValue; 00024 m_emax12 = new CriteriaItemValue; 00025 m_coste1 = new CriteriaItemValue; 00026 m_coste2 = new CriteriaItemValue; 00027 m_coste3 = new CriteriaItemValue; 00028 m_phi1 = new CriteriaItemValue; 00029 m_phi2 = new CriteriaItemValue; 00030 m_phi3 = new CriteriaItemValue; 00031 }
EFProcessCluster::~EFProcessCluster | ( | ) | [virtual] |
Definition at line 33 of file EFProcessCluster.cxx.
References m_acole, m_acop, m_coste1, m_coste2, m_coste3, m_emax1, m_emax12, m_emax2, m_emax3, m_nshower, m_phi1, m_phi2, and m_phi3.
00033 { 00034 delete m_emax1; 00035 delete m_emax2; 00036 delete m_emax3; 00037 delete m_emax12; 00038 delete m_coste1; 00039 delete m_coste2; 00040 delete m_coste3; 00041 delete m_phi1; 00042 delete m_phi2; 00043 delete m_phi3; 00044 delete m_acop; 00045 delete m_acole; 00046 delete m_nshower; 00047 }
StatusCode EFProcessCluster::execute | ( | ) |
Definition at line 126 of file EFProcessCluster.cxx.
References abs, EFResult::addToEFVec(), EFResult::appToEFVec(), cos(), electron, calibUtil::ERROR, Bes_Common::FATAL, Bes_Common::INFO, m_acole, m_acop, IEFAlgorithm::m_beam, m_coste1, m_coste2, m_coste3, IEFAlgorithm::m_ef, m_emax1, m_emax12, m_emax2, m_emax3, m_nshower, m_phi1, m_phi2, m_phi3, IEFAlgorithm::m_run, msgSvc(), phi1, phi2, phi3, positron, reset(), CriteriaItemValue::setValue(), EFResult::setVecBit(), and sin().
00126 { 00127 00128 reset(); 00129 00130 MsgStream log(msgSvc(), name()); 00131 //DataObject* pObject; 00132 float e1=0,e2=0; 00133 char* electron=getenv("BEPCII_INFO.BER_PRB"); 00134 if(electron){ 00135 e1=atof(electron); 00136 } 00137 else{ 00138 log << MSG::ERROR << "Cannot get beam energy (e-)! Please call online people" << endreq; 00139 } 00140 char* positron=getenv("BEPCII_INFO.BPR_PRB"); 00141 if(positron){ 00142 e2=atof(positron); 00143 } 00144 else{ 00145 log << MSG::ERROR << "Cannot get beam energy (e+)! Please call online people" << endreq; 00146 } 00147 if(e1>0.1&&e2>0.1&&m_beam>0) { 00148 m_beam = 0.5*(e1+e2); 00149 } 00150 else{ 00151 } 00152 log << MSG::INFO << "beam energy = " << m_beam << endreq; 00153 00154 // Part 1: Get the event header, print out event and run number 00155 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader"); 00156 if (!eventHeader) { 00157 log << MSG::FATAL << "Could not find Event Header" << endreq; 00158 return( StatusCode::FAILURE); 00159 } 00160 //Part 2: Retrieve Hits Collection 00161 SmartDataPtr<RecEmcShowerCol> emcShowerCol(eventSvc(),"/Event/Recon/RecEmcShowerCol"); 00162 if (!emcShowerCol) { 00163 log << MSG::FATAL << "Could not find Emc rec!!" << endreq; 00164 return( StatusCode::FAILURE); 00165 } 00166 //Part 3: Calculate acoplanarity of two-max energy showers 00167 RecEmcShowerCol::iterator iterShower=emcShowerCol->begin(); 00168 double max1=-999,max2=-999,max3=-999; 00169 double cost1=-999,cost2=-999,cost3=-999,phi1=-999,phi2=-999,phi3=-999; 00170 00171 unsigned int nshower=emcShowerCol->size(); 00172 for(;iterShower!= emcShowerCol->end();iterShower++){ 00173 if((*iterShower)->energy()>=max1){ 00174 max3=max2; 00175 max2=max1; 00176 cost3=cost2; 00177 cost2=cost1; 00178 phi3=phi2; 00179 phi2=phi1; 00180 max1=(*iterShower)->energy(); 00181 cost1=cos((*iterShower)->position().theta()); 00182 phi1=(*iterShower)->position().phi(); 00183 } 00184 else if((*iterShower)->energy()>max2){ 00185 max3=max2; 00186 cost3=cost2; 00187 phi3=phi2; 00188 max2=(*iterShower)->energy(); 00189 cost2=cos((*iterShower)->position().theta()); 00190 phi2=(*iterShower)->position().phi(); 00191 } 00192 else if((*iterShower)->energy()>max3){ 00193 max3=(*iterShower)->energy(); 00194 cost3=(*iterShower)->position().theta(); 00195 phi3=(*iterShower)->position().phi(); 00196 } 00197 } 00198 double acop=180,acol=180.; 00199 if(nshower>=2){ 00200 acop=180.-180./3.1415927*acos(cos(phi1)*cos(phi2)+sin(phi1)*sin(phi2)); 00201 acol=180.-180./3.1415927*acos(cos(phi1)*sin(acos(cost1))*cos(phi2)*sin(acos(cost2)) 00202 +sin(phi1)*sin(acos(cost1))*sin(phi2)*sin(acos(cost2)) 00203 +cost1*cost2); 00204 } 00205 00206 log << MSG::INFO << "nshower=" << nshower << "; acop=" << acop 00207 <<"; emax1="<< max1 <<"; emax2="<< max2 <<endreq; 00208 00209 //Part 4: Put the criteria item(s) to HltStoreSvc here 00210 m_nshower->setValue(nshower); 00211 m_acop->setValue(acop); 00212 m_acole->setValue(acol); 00213 m_emax1->setValue(max1/abs(m_beam)); 00214 m_emax2->setValue(max2/abs(m_beam)); 00215 m_emax3->setValue(max3/abs(m_beam)); 00216 m_emax12->setValue((max1+max2)/abs(m_beam)); 00217 m_coste1->setValue(cost1); 00218 m_coste2->setValue(cost2); 00219 m_coste3->setValue(cost3); 00220 m_phi1->setValue(phi1); 00221 m_phi2->setValue(phi2); 00222 m_phi3->setValue(phi3); 00223 00224 m_ef->addToEFVec(nshower, 38); 00225 m_ef->appToEFVec(max1, 39); 00226 m_ef->appToEFVec(cost1,40); 00227 m_ef->appToEFVec(phi1,41); 00228 m_ef->appToEFVec(max2, 42); 00229 m_ef->appToEFVec(cost2,43); 00230 m_ef->appToEFVec(phi2,44); 00231 m_ef->appToEFVec(acop, 45); 00232 m_ef->appToEFVec(acol, 46); 00233 m_ef->appToEFVec(max1+max2, 47); 00234 m_ef->appToEFVec(max3, 48); 00235 m_ef->appToEFVec(cost3,49); 00236 m_ef->appToEFVec(phi3,50); 00237 00238 m_ef->setVecBit(true, 0, 2); 00239 if(nshower==0)m_ef->addToEFVec(1<<16,1); 00240 else if(nshower==1)m_ef->addToEFVec(4<<16,1); 00241 else if(nshower==2)m_ef->addToEFVec(10<<16,1); 00242 else if(nshower>=3)m_ef->addToEFVec(13<<16,1); 00243 else m_ef->addToEFVec(0<<16,1); 00244 00245 m_run=1; 00246 00247 return StatusCode::SUCCESS; 00248 }
StatusCode EFProcessCluster::finalize | ( | ) |
Definition at line 250 of file EFProcessCluster.cxx.
References Bes_Common::INFO, and msgSvc().
00250 { 00251 MsgStream log(msgSvc(), name()); 00252 log << MSG::INFO << "in finalize()" << endmsg; 00253 return StatusCode::SUCCESS; 00254 }
StatusCode EFProcessCluster::initialize | ( | ) | [virtual] |
Reimplemented from IEFAlgorithm.
Definition at line 49 of file EFProcessCluster.cxx.
References calibUtil::ERROR, Bes_Common::INFO, IEFAlgorithm::initialize(), m_acole, m_acop, m_coste1, m_coste2, m_coste3, m_emax1, m_emax12, m_emax2, m_emax3, IEFAlgorithm::m_HltStoreSvc, m_nshower, m_phi1, m_phi2, m_phi3, msgSvc(), and HltStoreSvc::put().
00049 { 00050 00051 MsgStream log(msgSvc(), name()); 00052 log << MSG::INFO << "in initialize()" << endreq; 00053 00054 IEFAlgorithm::initialize(); 00055 00056 StatusCode sc; 00057 sc = m_HltStoreSvc->put("nshw", m_nshower); 00058 if ( sc.isFailure() ) { 00059 log << MSG::ERROR << "m_HltStoreSvc->put(nshw) wrong" << endreq; 00060 return sc; 00061 } 00062 sc = m_HltStoreSvc->put("acop", m_acop); 00063 if ( sc.isFailure() ) { 00064 log << MSG::ERROR << "m_HltStoreSvc->put(acop) wrong" << endreq; 00065 return sc; 00066 } 00067 sc = m_HltStoreSvc->put("acole", m_acole); 00068 if ( sc.isFailure() ) { 00069 log << MSG::ERROR << "m_HltStoreSvc->put(acole) wrong" << endreq; 00070 return sc; 00071 } 00072 sc = m_HltStoreSvc->put("emax1", m_emax1); 00073 if ( sc.isFailure() ) { 00074 log << MSG::ERROR << "m_HltStoreSvc->put(emax1) wrong" << endreq; 00075 return sc; 00076 } 00077 sc = m_HltStoreSvc->put("emax2", m_emax2); 00078 if ( sc.isFailure() ) { 00079 log << MSG::ERROR << "m_HltStoreSvc->put(emax2) wrong" << endreq; 00080 return sc; 00081 } 00082 sc = m_HltStoreSvc->put("emax3", m_emax3); 00083 if ( sc.isFailure() ) { 00084 log << MSG::ERROR << "m_HltStoreSvc->put(emax3) wrong" << endreq; 00085 return sc; 00086 } 00087 sc = m_HltStoreSvc->put("emax12", m_emax12); 00088 if ( sc.isFailure() ) { 00089 log << MSG::ERROR << "m_HltStoreSvc->put(emax12) wrong" << endreq; 00090 return sc; 00091 } 00092 sc = m_HltStoreSvc->put("coste1", m_coste1); 00093 if ( sc.isFailure() ) { 00094 log << MSG::ERROR << "m_HltStoreSvc->put(cos1) wrong" << endreq; 00095 return sc; 00096 } 00097 sc = m_HltStoreSvc->put("coste2", m_coste2); 00098 if ( sc.isFailure() ) { 00099 log << MSG::ERROR << "m_HltStoreSvc->put(cos2) wrong" << endreq; 00100 return sc; 00101 } 00102 sc = m_HltStoreSvc->put("coste3", m_coste3); 00103 if ( sc.isFailure() ) { 00104 log << MSG::ERROR << "m_HltStoreSvc->put(cos3) wrong" << endreq; 00105 return sc; 00106 } 00107 sc = m_HltStoreSvc->put("phi1", m_phi1); 00108 if ( sc.isFailure() ) { 00109 log << MSG::ERROR << "m_HltStoreSvc->put(phi1) wrong" << endreq; 00110 return sc; 00111 } 00112 sc = m_HltStoreSvc->put("phi2", m_phi2); 00113 if ( sc.isFailure() ) { 00114 log << MSG::ERROR << "m_HltStoreSvc->put(phi2) wrong" << endreq; 00115 return sc; 00116 } 00117 sc = m_HltStoreSvc->put("phi3", m_phi3); 00118 if ( sc.isFailure() ) { 00119 log << MSG::ERROR << "m_HltStoreSvc->put(phi3) wrong" << endreq; 00120 return sc; 00121 } 00122 00123 return StatusCode::SUCCESS; 00124 }
void EFProcessCluster::reset | ( | ) | [virtual] |
Implements IEFAlgorithm.
Definition at line 256 of file EFProcessCluster.cxx.
References m_acole, m_acop, m_coste1, m_coste2, m_coste3, m_emax1, m_emax12, m_emax2, m_emax3, m_nshower, m_phi1, m_phi2, m_phi3, IEFAlgorithm::m_run, and CriteriaItemValue::reset().
Referenced by execute().
00256 { 00257 00258 if(m_run) { 00259 m_nshower->reset(); 00260 m_acop->reset(); 00261 m_acole->reset(); 00262 m_emax1->reset(); 00263 m_emax2->reset(); 00264 m_emax3->reset(); 00265 m_emax12->reset(); 00266 m_coste1->reset(); 00267 m_coste2->reset(); 00268 m_coste3->reset(); 00269 m_phi1->reset(); 00270 m_phi2->reset(); 00271 m_phi3->reset(); 00272 m_run=0; 00273 } 00274 return; 00275 }
CriteriaItemValue* EFProcessCluster::m_acole [private] |
Definition at line 26 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
CriteriaItemValue* EFProcessCluster::m_acop [private] |
Definition at line 25 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
float IEFAlgorithm::m_beam [protected, inherited] |
Definition at line 17 of file IEFAlgorithm.h.
Referenced by execute(), EFGlobalEnergy::execute(), IEFAlgorithm::IEFAlgorithm(), and EFGlobalEnergy::initialize().
CriteriaItemValue* EFProcessCluster::m_coste1 [private] |
Definition at line 31 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
CriteriaItemValue* EFProcessCluster::m_coste2 [private] |
Definition at line 32 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
CriteriaItemValue* EFProcessCluster::m_coste3 [private] |
Definition at line 33 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
EFResult* IEFAlgorithm::m_ef [protected, inherited] |
Definition at line 22 of file IEFAlgorithm.h.
Referenced by EFSectorHits::execute(), execute(), EFGlobalEnergy::execute(), EFFlightTime::execute(), EFDetectorHits::execute(), EFChargedTrack::execute(), and IEFAlgorithm::initialize().
CriteriaItemValue* EFProcessCluster::m_emax1 [private] |
Definition at line 27 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
CriteriaItemValue* EFProcessCluster::m_emax12 [private] |
Definition at line 30 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
CriteriaItemValue* EFProcessCluster::m_emax2 [private] |
Definition at line 28 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
CriteriaItemValue* EFProcessCluster::m_emax3 [private] |
Definition at line 29 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
HltStoreSvc* IEFAlgorithm::m_HltStoreSvc [protected, inherited] |
Definition at line 20 of file IEFAlgorithm.h.
Referenced by EFSectorHits::execute(), IEFAlgorithm::initialize(), EFSectorHits::initialize(), initialize(), EFGlobalEnergy::initialize(), EFFlightTime::initialize(), EFDetectorHits::initialize(), and EFChargedTrack::initialize().
CriteriaItemValue* EFProcessCluster::m_nshower [private] |
Definition at line 24 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
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(), EFSectorHits::EFSectorHits(), and IEFAlgorithm::IEFAlgorithm().
CriteriaItemValue* EFProcessCluster::m_phi1 [private] |
Definition at line 34 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
CriteriaItemValue* EFProcessCluster::m_phi2 [private] |
Definition at line 35 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
CriteriaItemValue* EFProcessCluster::m_phi3 [private] |
Definition at line 36 of file EFProcessCluster.h.
Referenced by EFProcessCluster(), execute(), initialize(), reset(), and ~EFProcessCluster().
PropertyMgr IEFAlgorithm::m_propMgr [protected, inherited] |
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 EFSectorHits::execute(), execute(), EFGlobalEnergy::execute(), EFFlightTime::execute(), EFDetectorHits::execute(), EFChargedTrack::execute(), IEFAlgorithm::initialize(), EFSectorHits::reset(), reset(), EFGlobalEnergy::reset(), EFFlightTime::reset(), EFDetectorHits::reset(), and EFChargedTrack::reset().