BOSS 8.0.0
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 ()

Detailed Description

Definition at line 8 of file FillEventTag.h.

Constructor & Destructor Documentation

◆ FillEventTag()

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

Definition at line 9 of file FillEventTag.cxx.

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

Member Function Documentation

◆ execute()

StatusCode FillEventTag::execute ( )

charmonium resonance

Definition at line 25 of file FillEventTag.cxx.

25 {
26 MsgStream log( msgSvc(), name() );
27 // Get McParticle Collections
28 m_EventTag = initialEventTag;
29
30 if ( ( m_EventTag & 0xF ) == 1 ) return StatusCode::SUCCESS; // Real data
31
32 SmartDataPtr<Event::McParticleCol> mcParticles( eventSvc(), EventModel::MC::McParticleCol );
33 if ( !mcParticles )
34 {
35 log << MSG::ERROR << "Can not open McParticleCollection" << endmsg;
36 return StatusCode::SUCCESS;
37 }
38
39 if ( m_EventTag == 0 )
40 { // try autodetect general event type: check for ccbar resonance;
41 for ( Event::McParticleCol::iterator it = mcParticles->begin(); it != mcParticles->end();
42 it++ )
43 {
44 // if((*it)->itdecayInFlight())!!((*it)->primaryParticle())continue;
45 long int pdg = abs( ( *it )->particleProperty() );
46 if ( ( ( pdg % 1000 ) / 10 ) == 44 )
47 {
48 m_EventTag = ( (int)( pdg == 443 ) ) * 4 + ( (int)( pdg == 100443 ) ) * 5 +
49 ( (int)( pdg == 30443 ) ) * 6 + ( (int)( pdg == 9000443 ) ) * 7 +
50 ( (int)( pdg == 9010443 ) ) * 8 + ( (int)( pdg == 9020443 ) ) * 9;
51 break;
52 }
53 }
54 }
55
56 if ( m_EventTag == 0 )
57 { // try autodetect general event type;
58 m_EventTag = 2; // off-resonance data
59 for ( Event::McParticleCol::iterator it = mcParticles->begin(); it != mcParticles->end();
60 it++ )
61 {
62 if ( ( *it )->decayInFlight() || ( *it )->primaryParticle() ) continue;
63 long int pdg = abs( ( *it )->particleProperty() );
64 if ( pdg == 11 )
65 {
66 m_EventTag |= 0X20;
67 break;
68 }
69 else if ( pdg == 13 )
70 {
71 m_EventTag |= 0X30;
72 break;
73 }
74 else if ( pdg == 15 )
75 {
76 m_EventTag |= 0X40;
77 break;
78 }
79 else if ( ( pdg > 0 ) && ( pdg < 9 ) )
80 {
81 m_EventTag |= 0X50;
82 break;
83 }
84 }
85 }
86
87 if ( ( ( m_EventTag & 0xf ) > 3 ) && ( ( m_EventTag & 0xf ) < 9 ) )
88 { /// charmonium resonance
89 m_EventTag &= 0xf;
90 // find initial charmonium resonance;
91 for ( Event::McParticleCol::iterator it = mcParticles->begin(); it != mcParticles->end();
92 it++ )
93 {
94 long int pdg = ( *it )->particleProperty();
95 if ( ( ( pdg % 1000 ) / 10 ) != 44 ) continue;
96 // part=(*it);
97 m_EventTag |= ( m_EventTagSvc->getCharmDecayType( *it ) ) << 4;
98 m_EventTag |= ( m_EventTagSvc->getChainCode( *it ) ) << 8;
99 // printf("Chain code %20llX \n",(m_EventTagSvc->getChainCode(*it)));
100 break;
101 }
102 }
103 else if ( ( m_EventTag & 0xf ) == 0x2 )
104 { // off-resonance
105 // save topology info:
106 int ncha = 0;
107 int nneu = 0;
108 for ( Event::McParticleCol::iterator it = mcParticles->begin(); it != mcParticles->end();
109 it++ )
110 {
111 long int pdg = abs( ( *it )->particleProperty() );
112 bool good = ( !( *it )->decayInFlight() ) && ( !( *it )->primaryParticle() );
113 ncha += ( (int)( good && ( ( pdg == 11 ) || ( pdg == 13 ) || ( pdg == 211 ) ||
114 ( pdg == 321 ) || ( pdg == 2212 ) || ( pdg == 1011 ) ) ) );
115 nneu += ( (int)( good && ( ( pdg == 111 ) || ( pdg == 310 ) || ( pdg == 130 ) ||
116 ( pdg == 2112 ) ) ) );
117 // printf("%2i %6i %2i %2i Nneu:%3i Ncha:%3i \n",
118 // (*it)->trackIndex(),pdg,
119 // ((pdg==11)||(pdg==13)||(pdg==211)||(pdg==321)||(pdg==2212)||(pdg==1011)),
120 // ((pdg==111)||(pdg==310)||(pdg==130)||(pdg==2112)),
121 // nneu,ncha);
122 }
123 m_EventTag |= ( ( ncha & 0xF ) << 8 );
124 m_EventTag |= ( ( nneu & 0xF ) << 12 );
125 if ( ( m_EventTag & 0xf0 ) == 0x40 )
126 { // tau-tau event
127 // cout<< "XXXXXXXXX" <<endl;
128 for ( Event::McParticleCol::iterator it = mcParticles->begin(); it != mcParticles->end();
129 it++ )
130 {
131 long int pdg = ( *it )->particleProperty();
132 // cout<<" YYY: "<<pdg<<endl;
133 if ( pdg == -15 )
134 {
135 m_EventTag |= ( m_EventTagSvc->getDecayCode( *it ) ) << 16;
136 // cout <<"DEcay cod for a-tau:" <<(m_EventTagSvc->getDecayCode(*it))<<endl;
137 }
138 else if ( pdg == 15 )
139 {
140 m_EventTag |= ( m_EventTagSvc->getDecayCode( *it ) ) << 24;
141 // cout <<"DEcay cod for tau:" <<(m_EventTagSvc->getDecayCode(*it))<<endl;
142 }
143 }
144 }
145 }
146
147 SmartDataPtr<Event::EventHeader> evHead( eventSvc(), EventModel::EventHeader );
148 if ( !evHead )
149 {
150 log << MSG::ERROR << " Can not to retreave EventHeader" << endmsg;
151 return StatusCode::SUCCESS;
152 }
153 evHead->setEventTag( m_EventTag );
154
155 return StatusCode::SUCCESS;
156}
IMessageSvc * msgSvc()

◆ finalize()

StatusCode FillEventTag::finalize ( )

Definition at line 158 of file FillEventTag.cxx.

158 {
159 MsgStream log( msgSvc(), name() );
160 return StatusCode::SUCCESS;
161}

◆ initialize()

StatusCode FillEventTag::initialize ( )

Definition at line 14 of file FillEventTag.cxx.

14 {
15 MsgStream log( msgSvc(), name() );
16 static const bool CREATEIFNOTTHERE( true );
17 StatusCode EventTagSvcStatus = service( "EventTagSvc", m_EventTagSvc, CREATEIFNOTTHERE );
18 if ( !EventTagSvcStatus.isSuccess() )
19 {
20 log << MSG::ERROR << " Could not initialize Decay code service" << endmsg;
21 return EventTagSvcStatus;
22 }
23 return StatusCode::SUCCESS;
24}

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