#include <FillEventTag.h>
Public Member Functions | |
FillEventTag (const std::string &name, ISvcLocator *pSvcLocator) | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
Private Attributes | |
IEventTagSvc * | m_EventTagSvc |
unsigned int | m_EventTag |
unsigned int | initialEventTag |
Definition at line 7 of file FillEventTag.h.
FillEventTag::FillEventTag | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 11 of file FillEventTag.cxx.
References initialEventTag.
00011 : 00012 Algorithm(name, pSvcLocator) 00013 { 00014 declareProperty("GeneralEventType", initialEventTag=0); 00015 }
StatusCode FillEventTag::execute | ( | ) |
Definition at line 28 of file FillEventTag.cxx.
References abs, calibUtil::ERROR, EventModel::EventHeader, IEventTagSvc::getChainCode(), IEventTagSvc::getCharmDecayType(), IEventTagSvc::getDecayCode(), initialEventTag, m_EventTag, m_EventTagSvc, EventModel::MC::McParticleCol, and msgSvc().
00029 { 00030 MsgStream log(msgSvc(), name()); 00031 // Get McParticle Collections 00032 m_EventTag =initialEventTag; 00033 00034 00035 if((m_EventTag&0xF)==1)return StatusCode::SUCCESS; //Real data 00036 00037 SmartDataPtr<Event::McParticleCol> mcParticles(eventSvc(),EventModel::MC::McParticleCol); 00038 if(!mcParticles){ 00039 log<<MSG::ERROR<<"Can not open McParticleCollection" <<endreq; 00040 return StatusCode::SUCCESS; 00041 } 00042 00043 if(m_EventTag==0){//try autodetect general event type: check for ccbar resonance; 00044 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){ 00045 // if((*it)->itdecayInFlight())!!((*it)->primaryParticle())continue; 00046 long int pdg=abs((*it)->particleProperty()); 00047 if(((pdg%1000)/10) == 44){ 00048 m_EventTag=((int)(pdg==443))*4+((int)(pdg==100443))*5+((int)(pdg==30443))*6 00049 +((int)(pdg==9000443))*7+((int)(pdg==9010443))*8+((int)(pdg==9020443))*9; 00050 break; 00051 } 00052 } 00053 } 00054 00055 if(m_EventTag==0){//try autodetect general event type; 00056 m_EventTag=2; //off-resonance data 00057 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){ 00058 if((*it)->decayInFlight() || (*it)->primaryParticle()) continue; 00059 long int pdg=abs((*it)->particleProperty()); 00060 if(pdg==11){ 00061 m_EventTag|=0X20; 00062 break; 00063 } 00064 else if(pdg==13){ 00065 m_EventTag|=0X30; 00066 break; 00067 } 00068 else if(pdg==15){ 00069 m_EventTag|=0X40; 00070 break; 00071 } 00072 else if((pdg>0)&&(pdg<9)){ 00073 m_EventTag|=0X50; 00074 break; 00075 } 00076 } 00077 } 00078 00079 00080 if(((m_EventTag&0xf)>3)&&((m_EventTag&0xf)<9)){ 00081 m_EventTag &= 0xf; 00082 // find initial charmonium resonance; 00083 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){ 00084 long int pdg=(*it)->particleProperty(); 00085 if(((pdg%1000)/10) != 44)continue; 00086 // part=(*it); 00087 m_EventTag |= (m_EventTagSvc->getCharmDecayType(*it))<<4; 00088 m_EventTag |= (m_EventTagSvc->getChainCode(*it))<<8; 00089 // printf("Chain code %20llX \n",(m_EventTagSvc->getChainCode(*it))); 00090 break; 00091 } 00092 } 00093 else if((m_EventTag&0xf)==0x2){ //off-resonance 00094 //save topology info: 00095 int ncha=0; 00096 int nneu=0; 00097 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){ 00098 long int pdg=abs((*it)->particleProperty()); 00099 bool good=(!(*it)->decayInFlight())&&(!(*it)->primaryParticle()); 00100 ncha+=((int)(good&&((pdg==11)||(pdg==13)||(pdg==211)||(pdg==321)||(pdg==2212)||(pdg==1011)))); 00101 nneu+=((int)(good&&((pdg==111)||(pdg==310)||(pdg==130)||(pdg==2112)))); 00102 // printf("%2i %6i %2i %2i Nneu:%3i Ncha:%3i \n", 00103 // (*it)->trackIndex(),pdg, 00104 // ((pdg==11)||(pdg==13)||(pdg==211)||(pdg==321)||(pdg==2212)||(pdg==1011)), 00105 // ((pdg==111)||(pdg==310)||(pdg==130)||(pdg==2112)), 00106 // nneu,ncha); 00107 } 00108 m_EventTag|=((ncha&0xF)<<8); 00109 m_EventTag|=((nneu&0xF)<<12); 00110 if((m_EventTag&0xf0)==0x40){//tau-tau event 00111 //cout<< "XXXXXXXXX" <<endl; 00112 for(Event::McParticleCol::iterator it=mcParticles->begin();it!=mcParticles->end();it++){ 00113 long int pdg=(*it)->particleProperty(); 00114 // cout<<" YYY: "<<pdg<<endl; 00115 if(pdg==-15){ 00116 m_EventTag |=(m_EventTagSvc->getDecayCode(*it))<<16; 00117 // cout <<"DEcay cod for a-tau:" <<(m_EventTagSvc->getDecayCode(*it))<<endl; 00118 }else if(pdg==15){ 00119 m_EventTag |=(m_EventTagSvc->getDecayCode(*it))<<24; 00120 //cout <<"DEcay cod for tau:" <<(m_EventTagSvc->getDecayCode(*it))<<endl; 00121 } 00122 } 00123 } 00124 } 00125 00126 00127 SmartDataPtr<Event::EventHeader> evHead(eventSvc(),EventModel::EventHeader); 00128 if(!evHead){ 00129 log<<MSG::ERROR<< " Can not to retreave EventHeader" << endreq; 00130 return StatusCode::SUCCESS; 00131 } 00132 evHead->setEventTag(m_EventTag); 00133 00134 return StatusCode::SUCCESS; 00135 }
StatusCode FillEventTag::finalize | ( | ) |
Definition at line 137 of file FillEventTag.cxx.
References msgSvc().
00137 { 00138 MsgStream log(msgSvc(), name()); 00139 return StatusCode::SUCCESS; 00140 }
StatusCode FillEventTag::initialize | ( | ) |
Definition at line 17 of file FillEventTag.cxx.
References calibUtil::ERROR, m_EventTagSvc, and msgSvc().
00018 { 00019 MsgStream log(msgSvc(), name()); 00020 static const bool CREATEIFNOTTHERE(true); 00021 StatusCode EventTagSvcStatus = service("EventTagSvc", m_EventTagSvc, CREATEIFNOTTHERE); 00022 if (!EventTagSvcStatus.isSuccess()) { 00023 log << MSG::ERROR << " Could not initialize Decay code service" << endreq; 00024 return EventTagSvcStatus; 00025 } 00026 return StatusCode::SUCCESS; 00027 }
unsigned int FillEventTag::initialEventTag [private] |
unsigned int FillEventTag::m_EventTag [private] |
IEventTagSvc* FillEventTag::m_EventTagSvc [private] |