29{
30 MsgStream log(
msgSvc(), name());
31
32 m_EventTag =initialEventTag;
33
34
35 if((m_EventTag&0xF)==1)return StatusCode::SUCCESS;
36
38 if(!mcParticles){
39 log<<MSG::ERROR<<"Can not open McParticleCollection" <<endreq;
40 return StatusCode::SUCCESS;
41 }
42
43 if(m_EventTag==0){
44 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){
45
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;
50 break;
51 }
52 }
53 }
54
55 if(m_EventTag==0){
56 m_EventTag=2;
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());
60 if(pdg==11){
61 m_EventTag|=0X20;
62 break;
63 }
64 else if(pdg==13){
65 m_EventTag|=0X30;
66 break;
67 }
68 else if(pdg==15){
69 m_EventTag|=0X40;
70 break;
71 }
72 else if((pdg>0)&&(pdg<9)){
73 m_EventTag|=0X50;
74 break;
75 }
76 }
77 }
78
79
80 if(((m_EventTag&0xf)>3)&&((m_EventTag&0xf)<9)){
81 m_EventTag &= 0xf;
82
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;
86
89
90 break;
91 }
92 }
93 else if((m_EventTag&0xf)==0x2){
94
95 int ncha=0;
96 int nneu=0;
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))));
102
103
104
105
106
107 }
108 m_EventTag|=((ncha&0xF)<<8);
109 m_EventTag|=((nneu&0xF)<<12);
110 if((m_EventTag&0xf0)==0x40){
111
112 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){
113 long int pdg=(*it)->particleProperty();
114
115 if(pdg==-15){
117
118 }else if(pdg==15){
120
121 }
122 }
123 }
124 }
125
126
127 SmartDataPtr<Event::EventHeader> evHead(eventSvc(),EventModel::EventHeader);
128 if(!evHead){
129 log<<MSG::ERROR<< " Can not to retreave EventHeader" << endreq;
130 return StatusCode::SUCCESS;
131 }
132 evHead->setEventTag(m_EventTag);
133
134 return StatusCode::SUCCESS;
135}
double abs(const EvtComplex &c)
_EXTERN_ std::string McParticleCol