BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
FillEventTag Class Reference

#include <FillEventTag.h>

+ Inheritance diagram for FillEventTag:

Public Member Functions

 FillEventTag (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 FillEventTag (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Constructor & Destructor Documentation

◆ FillEventTag() [1/2]

FillEventTag::FillEventTag ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 11 of file FillEventTag.cxx.

11 :
12 Algorithm(name, pSvcLocator)
13{
14 declareProperty("GeneralEventType", initialEventTag=0);
15}

◆ FillEventTag() [2/2]

FillEventTag::FillEventTag ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Member Function Documentation

◆ execute() [1/2]

StatusCode FillEventTag::execute ( )

charmonium resonance

Definition at line 28 of file FillEventTag.cxx.

29{
30 MsgStream log(msgSvc(), name());
31 // Get McParticle Collections
32 m_EventTag =initialEventTag;
33
34
35 if((m_EventTag&0xF)==1)return StatusCode::SUCCESS; //Real data
36
37 SmartDataPtr<Event::McParticleCol> mcParticles(eventSvc(),EventModel::MC::McParticleCol);
38 if(!mcParticles){
39 log<<MSG::ERROR<<"Can not open McParticleCollection" <<endreq;
40 return StatusCode::SUCCESS;
41 }
42
43 if(m_EventTag==0){//try autodetect general event type: check for ccbar resonance;
44 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){
45 // if((*it)->itdecayInFlight())!!((*it)->primaryParticle())continue;
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){//try autodetect general event type;
56 m_EventTag=2; //off-resonance data
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)){ /// charmonium resonance
81 m_EventTag &= 0xf;
82 // find initial charmonium resonance;
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 // part=(*it);
87 m_EventTag |= (m_EventTagSvc->getCharmDecayType(*it))<<4;
88 m_EventTag |= (m_EventTagSvc->getChainCode(*it))<<8;
89 // printf("Chain code %20llX \n",(m_EventTagSvc->getChainCode(*it)));
90 break;
91 }
92 }
93 else if((m_EventTag&0xf)==0x2){ //off-resonance
94 //save topology info:
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// printf("%2i %6i %2i %2i Nneu:%3i Ncha:%3i \n",
103// (*it)->trackIndex(),pdg,
104// ((pdg==11)||(pdg==13)||(pdg==211)||(pdg==321)||(pdg==2212)||(pdg==1011)),
105// ((pdg==111)||(pdg==310)||(pdg==130)||(pdg==2112)),
106// nneu,ncha);
107 }
108 m_EventTag|=((ncha&0xF)<<8);
109 m_EventTag|=((nneu&0xF)<<12);
110 if((m_EventTag&0xf0)==0x40){//tau-tau event
111 //cout<< "XXXXXXXXX" <<endl;
112 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){
113 long int pdg=(*it)->particleProperty();
114 // cout<<" YYY: "<<pdg<<endl;
115 if(pdg==-15){
116 m_EventTag |=(m_EventTagSvc->getDecayCode(*it))<<16;
117 // cout <<"DEcay cod for a-tau:" <<(m_EventTagSvc->getDecayCode(*it))<<endl;
118 }else if(pdg==15){
119 m_EventTag |=(m_EventTagSvc->getDecayCode(*it))<<24;
120 //cout <<"DEcay cod for tau:" <<(m_EventTagSvc->getDecayCode(*it))<<endl;
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}
virtual unsigned long long int getChainCode(Event::McParticle *part)=0
virtual int getDecayCode(Event::McParticle *part)=0
virtual unsigned int getCharmDecayType(Event::McParticle *part)=0

◆ execute() [2/2]

StatusCode FillEventTag::execute ( )

◆ finalize() [1/2]

StatusCode FillEventTag::finalize ( )

Definition at line 137 of file FillEventTag.cxx.

137 {
138 MsgStream log(msgSvc(), name());
139 return StatusCode::SUCCESS;
140}

◆ finalize() [2/2]

StatusCode FillEventTag::finalize ( )

◆ initialize() [1/2]

StatusCode FillEventTag::initialize ( )

Definition at line 17 of file FillEventTag.cxx.

18{
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;
25 }
26 return StatusCode::SUCCESS;
27}

◆ initialize() [2/2]

StatusCode FillEventTag::initialize ( )

The documentation for this class was generated from the following files: