BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EFProcessCluster.cxx
Go to the documentation of this file.
1#include "GaudiKernel/MsgStream.h"
2// #include "GaudiKernel/AlgFactory.h"
3#include "GaudiKernel/SmartDataPtr.h"
4// #include "GaudiKernel/PropertyMgr.h"
5#include "EmcRecEventModel/RecEmcEventModel.h"
6#include "EventModel/Event.h"
7#include "EventModel/EventHeader.h"
9
10using namespace Event;
11
12EFProcessCluster::EFProcessCluster( const std::string& name, ISvcLocator* pSvcLocator )
13 : IEFAlgorithm( name, pSvcLocator ) {
14 int output = ( m_output % 10000 ) / 1000;
15 // declareProperty("OutputLevel",m_output = MSG::NIL);
16 MsgStream log( msgSvc(), name );
17 msgSvc()->setOutputLevel( name, output );
18 m_nshower = new CriteriaItemValue;
19 m_acop = new CriteriaItemValue;
20 m_acole = new CriteriaItemValue;
21 m_emax1 = new CriteriaItemValue;
22 m_emax2 = new CriteriaItemValue;
23 m_emax3 = new CriteriaItemValue;
24 m_emax12 = new CriteriaItemValue;
25 m_coste1 = new CriteriaItemValue;
26 m_coste2 = new CriteriaItemValue;
27 m_coste3 = new CriteriaItemValue;
28 m_phi1 = new CriteriaItemValue;
29 m_phi2 = new CriteriaItemValue;
30 m_phi3 = new CriteriaItemValue;
31}
32
34 delete m_emax1;
35 delete m_emax2;
36 delete m_emax3;
37 delete m_emax12;
38 delete m_coste1;
39 delete m_coste2;
40 delete m_coste3;
41 delete m_phi1;
42 delete m_phi2;
43 delete m_phi3;
44 delete m_acop;
45 delete m_acole;
46 delete m_nshower;
47}
48
50
51 MsgStream log( msgSvc(), name() );
52 log << MSG::INFO << "in initialize()" << endmsg;
53
55
56 StatusCode sc;
57 sc = m_HltStoreSvc->put( "nshw", m_nshower );
58 if ( sc.isFailure() )
59 {
60 log << MSG::ERROR << "m_HltStoreSvc->put(nshw) wrong" << endmsg;
61 return sc;
62 }
63 sc = m_HltStoreSvc->put( "acop", m_acop );
64 if ( sc.isFailure() )
65 {
66 log << MSG::ERROR << "m_HltStoreSvc->put(acop) wrong" << endmsg;
67 return sc;
68 }
69 sc = m_HltStoreSvc->put( "acole", m_acole );
70 if ( sc.isFailure() )
71 {
72 log << MSG::ERROR << "m_HltStoreSvc->put(acole) wrong" << endmsg;
73 return sc;
74 }
75 sc = m_HltStoreSvc->put( "emax1", m_emax1 );
76 if ( sc.isFailure() )
77 {
78 log << MSG::ERROR << "m_HltStoreSvc->put(emax1) wrong" << endmsg;
79 return sc;
80 }
81 sc = m_HltStoreSvc->put( "emax2", m_emax2 );
82 if ( sc.isFailure() )
83 {
84 log << MSG::ERROR << "m_HltStoreSvc->put(emax2) wrong" << endmsg;
85 return sc;
86 }
87 sc = m_HltStoreSvc->put( "emax3", m_emax3 );
88 if ( sc.isFailure() )
89 {
90 log << MSG::ERROR << "m_HltStoreSvc->put(emax3) wrong" << endmsg;
91 return sc;
92 }
93 sc = m_HltStoreSvc->put( "emax12", m_emax12 );
94 if ( sc.isFailure() )
95 {
96 log << MSG::ERROR << "m_HltStoreSvc->put(emax12) wrong" << endmsg;
97 return sc;
98 }
99 sc = m_HltStoreSvc->put( "coste1", m_coste1 );
100 if ( sc.isFailure() )
101 {
102 log << MSG::ERROR << "m_HltStoreSvc->put(cos1) wrong" << endmsg;
103 return sc;
104 }
105 sc = m_HltStoreSvc->put( "coste2", m_coste2 );
106 if ( sc.isFailure() )
107 {
108 log << MSG::ERROR << "m_HltStoreSvc->put(cos2) wrong" << endmsg;
109 return sc;
110 }
111 sc = m_HltStoreSvc->put( "coste3", m_coste3 );
112 if ( sc.isFailure() )
113 {
114 log << MSG::ERROR << "m_HltStoreSvc->put(cos3) wrong" << endmsg;
115 return sc;
116 }
117 sc = m_HltStoreSvc->put( "phi1", m_phi1 );
118 if ( sc.isFailure() )
119 {
120 log << MSG::ERROR << "m_HltStoreSvc->put(phi1) wrong" << endmsg;
121 return sc;
122 }
123 sc = m_HltStoreSvc->put( "phi2", m_phi2 );
124 if ( sc.isFailure() )
125 {
126 log << MSG::ERROR << "m_HltStoreSvc->put(phi2) wrong" << endmsg;
127 return sc;
128 }
129 sc = m_HltStoreSvc->put( "phi3", m_phi3 );
130 if ( sc.isFailure() )
131 {
132 log << MSG::ERROR << "m_HltStoreSvc->put(phi3) wrong" << endmsg;
133 return sc;
134 }
135
136 return StatusCode::SUCCESS;
137}
138
140
141 reset();
142
143 MsgStream log( msgSvc(), name() );
144 // DataObject* pObject;
145 float e1 = 0, e2 = 0;
146 char* electron = getenv( "BEPCII_INFO.BER_PRB" );
147 if ( electron ) { e1 = atof( electron ); }
148 else
149 { log << MSG::ERROR << "Cannot get beam energy (e-)! Please call online people" << endmsg; }
150 char* positron = getenv( "BEPCII_INFO.BPR_PRB" );
151 if ( positron ) { e2 = atof( positron ); }
152 else
153 { log << MSG::ERROR << "Cannot get beam energy (e+)! Please call online people" << endmsg; }
154 if ( e1 > 0.1 && e2 > 0.1 && m_beam > 0 ) { m_beam = 0.5 * ( e1 + e2 ); }
155 else {}
156 log << MSG::INFO << "beam energy = " << m_beam << endmsg;
157
158 // Part 1: Get the event header, print out event and run number
159 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
160 if ( !eventHeader )
161 {
162 log << MSG::FATAL << "Could not find Event Header" << endmsg;
163 return ( StatusCode::FAILURE );
164 }
165 // Part 2: Retrieve Hits Collection
166 SmartDataPtr<RecEmcShowerCol> emcShowerCol( eventSvc(), "/Event/Recon/RecEmcShowerCol" );
167 if ( !emcShowerCol )
168 {
169 log << MSG::FATAL << "Could not find Emc rec!!" << endmsg;
170 return ( StatusCode::FAILURE );
171 }
172 // Part 3: Calculate acoplanarity of two-max energy showers
173 RecEmcShowerCol::iterator iterShower = emcShowerCol->begin();
174 double max1 = -999, max2 = -999, max3 = -999;
175 double cost1 = -999, cost2 = -999, cost3 = -999, phi1 = -999, phi2 = -999, phi3 = -999;
176
177 unsigned int nshower = emcShowerCol->size();
178 for ( ; iterShower != emcShowerCol->end(); iterShower++ )
179 {
180 if ( ( *iterShower )->energy() >= max1 )
181 {
182 max3 = max2;
183 max2 = max1;
184 cost3 = cost2;
185 cost2 = cost1;
186 phi3 = phi2;
187 phi2 = phi1;
188 max1 = ( *iterShower )->energy();
189 cost1 = cos( ( *iterShower )->position().theta() );
190 phi1 = ( *iterShower )->position().phi();
191 }
192 else if ( ( *iterShower )->energy() > max2 )
193 {
194 max3 = max2;
195 cost3 = cost2;
196 phi3 = phi2;
197 max2 = ( *iterShower )->energy();
198 cost2 = cos( ( *iterShower )->position().theta() );
199 phi2 = ( *iterShower )->position().phi();
200 }
201 else if ( ( *iterShower )->energy() > max3 )
202 {
203 max3 = ( *iterShower )->energy();
204 cost3 = ( *iterShower )->position().theta();
205 phi3 = ( *iterShower )->position().phi();
206 }
207 }
208 double acop = 180, acol = 180.;
209 if ( nshower >= 2 )
210 {
211 acop = 180. -
212 180. / 3.1415927 * acos( cos( phi1 ) * cos( phi2 ) + sin( phi1 ) * sin( phi2 ) );
213 acol = 180. -
214 180. / 3.1415927 *
215 acos( cos( phi1 ) * sin( acos( cost1 ) ) * cos( phi2 ) * sin( acos( cost2 ) ) +
216 sin( phi1 ) * sin( acos( cost1 ) ) * sin( phi2 ) * sin( acos( cost2 ) ) +
217 cost1 * cost2 );
218 }
219
220 log << MSG::INFO << "nshower=" << nshower << "; acop=" << acop << "; emax1=" << max1
221 << "; emax2=" << max2 << endmsg;
222
223 // Part 4: Put the criteria item(s) to HltStoreSvc here
224 m_nshower->setValue( nshower );
225 m_acop->setValue( acop );
226 m_acole->setValue( acol );
227 m_emax1->setValue( max1 / abs( m_beam ) );
228 m_emax2->setValue( max2 / abs( m_beam ) );
229 m_emax3->setValue( max3 / abs( m_beam ) );
230 m_emax12->setValue( ( max1 + max2 ) / abs( m_beam ) );
231 m_coste1->setValue( cost1 );
232 m_coste2->setValue( cost2 );
233 m_coste3->setValue( cost3 );
234 m_phi1->setValue( phi1 );
235 m_phi2->setValue( phi2 );
236 m_phi3->setValue( phi3 );
237
238 m_ef->addToEFVec( nshower, 38 );
239 m_ef->appToEFVec( max1, 39 );
240 m_ef->appToEFVec( cost1, 40 );
241 m_ef->appToEFVec( phi1, 41 );
242 m_ef->appToEFVec( max2, 42 );
243 m_ef->appToEFVec( cost2, 43 );
244 m_ef->appToEFVec( phi2, 44 );
245 m_ef->appToEFVec( acop, 45 );
246 m_ef->appToEFVec( acol, 46 );
247 m_ef->appToEFVec( max1 + max2, 47 );
248 m_ef->appToEFVec( max3, 48 );
249 m_ef->appToEFVec( cost3, 49 );
250 m_ef->appToEFVec( phi3, 50 );
251
252 m_ef->setVecBit( true, 0, 2 );
253 if ( nshower == 0 ) m_ef->addToEFVec( 1 << 16, 1 );
254 else if ( nshower == 1 ) m_ef->addToEFVec( 4 << 16, 1 );
255 else if ( nshower == 2 ) m_ef->addToEFVec( 10 << 16, 1 );
256 else if ( nshower >= 3 ) m_ef->addToEFVec( 13 << 16, 1 );
257 else m_ef->addToEFVec( 0 << 16, 1 );
258
259 m_run = 1;
260
261 return StatusCode::SUCCESS;
262}
263
265 MsgStream log( msgSvc(), name() );
266 log << MSG::INFO << "in finalize()" << endmsg;
267 return StatusCode::SUCCESS;
268}
269
271
272 if ( m_run )
273 {
274 m_nshower->reset();
275 m_acop->reset();
276 m_acole->reset();
277 m_emax1->reset();
278 m_emax2->reset();
279 m_emax3->reset();
280 m_emax12->reset();
281 m_coste1->reset();
282 m_coste2->reset();
283 m_coste3->reset();
284 m_phi1->reset();
285 m_phi2->reset();
286 m_phi3->reset();
287 m_run = 0;
288 }
289 return;
290}
Double_t phi2
Double_t phi1
Double_t e1
Double_t e2
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per saves r n generator level $ !Flag for chat level in output
Definition FoamA.h:89
IMessageSvc * msgSvc()
EFProcessCluster(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize()
EFResult * m_ef
IEFAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize()
HltStoreSvc * m_HltStoreSvc