2#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/SmartDataPtr.h"
4#include "GaudiKernel/MsgStream.h"
12 Algorithm(name, pSvcLocator)
14 declareProperty(
"GeneralEventType", initialEventTag=0);
19 MsgStream log(
msgSvc(), name());
20 static const bool CREATEIFNOTTHERE(
true);
21 StatusCode EventTagSvcStatus = service(
"EventTagSvc", m_EventTagSvc, CREATEIFNOTTHERE);
22 if (!EventTagSvcStatus.isSuccess()) {
23 log << MSG::ERROR <<
" Could not initialize Decay code service" << endreq;
24 return EventTagSvcStatus;
26 return StatusCode::SUCCESS;
30 MsgStream log(
msgSvc(), name());
32 m_EventTag =initialEventTag;
35 if((m_EventTag&0xF)==1)
return StatusCode::SUCCESS;
39 log<<MSG::ERROR<<
"Can not open McParticleCollection" <<endreq;
40 return StatusCode::SUCCESS;
44 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){
46 long int pdg=
abs((*it)->particleProperty());
47 if(((pdg%1000)/10) == 44){
48 m_EventTag=((int)(pdg==443))*4+((
int)(pdg==100443))*5+((int)(pdg==30443))*6
49 +((
int)(pdg==9000443))*7+((int)(pdg==9010443))*8+((
int)(pdg==9020443))*9;
57 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){
58 if((*it)->decayInFlight() || (*it)->primaryParticle())
continue;
59 long int pdg=
abs((*it)->particleProperty());
72 else if((pdg>0)&&(pdg<9)){
80 if(((m_EventTag&0xf)>3)&&((m_EventTag&0xf)<9)){
83 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){
84 long int pdg=(*it)->particleProperty();
85 if(((pdg%1000)/10) != 44)
continue;
93 else if((m_EventTag&0xf)==0x2){
97 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){
98 long int pdg=
abs((*it)->particleProperty());
99 bool good=(!(*it)->decayInFlight())&&(!(*it)->primaryParticle());
100 ncha+=((int)(good&&((pdg==11)||(pdg==13)||(pdg==211)||(pdg==321)||(pdg==2212)||(pdg==1011))));
101 nneu+=((int)(good&&((pdg==111)||(pdg==310)||(pdg==130)||(pdg==2112))));
108 m_EventTag|=((ncha&0xF)<<8);
109 m_EventTag|=((nneu&0xF)<<12);
110 if((m_EventTag&0xf0)==0x40){
112 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){
113 long int pdg=(*it)->particleProperty();
127 SmartDataPtr<Event::EventHeader> evHead(eventSvc(),EventModel::EventHeader);
129 log<<MSG::ERROR<<
" Can not to retreave EventHeader" << endreq;
130 return StatusCode::SUCCESS;
132 evHead->setEventTag(m_EventTag);
134 return StatusCode::SUCCESS;
138 MsgStream log(
msgSvc(), name());
139 return StatusCode::SUCCESS;
FillEventTag(const std::string &name, ISvcLocator *pSvcLocator)
_EXTERN_ std::string McParticleCol