BOSS 7.0.4
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 "EventModel/Event.h"
6#include "EventModel/EventHeader.h"
7#include "EmcRecEventModel/RecEmcEventModel.h"
8#include "HltAlgorithms/EFProcessCluster.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()" << endreq;
53
55
56 StatusCode sc;
57 sc = m_HltStoreSvc->put("nshw", m_nshower);
58 if ( sc.isFailure() ) {
59 log << MSG::ERROR << "m_HltStoreSvc->put(nshw) wrong" << endreq;
60 return sc;
61 }
62 sc = m_HltStoreSvc->put("acop", m_acop);
63 if ( sc.isFailure() ) {
64 log << MSG::ERROR << "m_HltStoreSvc->put(acop) wrong" << endreq;
65 return sc;
66 }
67 sc = m_HltStoreSvc->put("acole", m_acole);
68 if ( sc.isFailure() ) {
69 log << MSG::ERROR << "m_HltStoreSvc->put(acole) wrong" << endreq;
70 return sc;
71 }
72 sc = m_HltStoreSvc->put("emax1", m_emax1);
73 if ( sc.isFailure() ) {
74 log << MSG::ERROR << "m_HltStoreSvc->put(emax1) wrong" << endreq;
75 return sc;
76 }
77 sc = m_HltStoreSvc->put("emax2", m_emax2);
78 if ( sc.isFailure() ) {
79 log << MSG::ERROR << "m_HltStoreSvc->put(emax2) wrong" << endreq;
80 return sc;
81 }
82 sc = m_HltStoreSvc->put("emax3", m_emax3);
83 if ( sc.isFailure() ) {
84 log << MSG::ERROR << "m_HltStoreSvc->put(emax3) wrong" << endreq;
85 return sc;
86 }
87 sc = m_HltStoreSvc->put("emax12", m_emax12);
88 if ( sc.isFailure() ) {
89 log << MSG::ERROR << "m_HltStoreSvc->put(emax12) wrong" << endreq;
90 return sc;
91 }
92 sc = m_HltStoreSvc->put("coste1", m_coste1);
93 if ( sc.isFailure() ) {
94 log << MSG::ERROR << "m_HltStoreSvc->put(cos1) wrong" << endreq;
95 return sc;
96 }
97 sc = m_HltStoreSvc->put("coste2", m_coste2);
98 if ( sc.isFailure() ) {
99 log << MSG::ERROR << "m_HltStoreSvc->put(cos2) wrong" << endreq;
100 return sc;
101 }
102 sc = m_HltStoreSvc->put("coste3", m_coste3);
103 if ( sc.isFailure() ) {
104 log << MSG::ERROR << "m_HltStoreSvc->put(cos3) wrong" << endreq;
105 return sc;
106 }
107 sc = m_HltStoreSvc->put("phi1", m_phi1);
108 if ( sc.isFailure() ) {
109 log << MSG::ERROR << "m_HltStoreSvc->put(phi1) wrong" << endreq;
110 return sc;
111 }
112 sc = m_HltStoreSvc->put("phi2", m_phi2);
113 if ( sc.isFailure() ) {
114 log << MSG::ERROR << "m_HltStoreSvc->put(phi2) wrong" << endreq;
115 return sc;
116 }
117 sc = m_HltStoreSvc->put("phi3", m_phi3);
118 if ( sc.isFailure() ) {
119 log << MSG::ERROR << "m_HltStoreSvc->put(phi3) wrong" << endreq;
120 return sc;
121 }
122
123 return StatusCode::SUCCESS;
124}
125
127
128 reset();
129
130 MsgStream log(msgSvc(), name());
131 //DataObject* pObject;
132 float e1=0,e2=0;
133 char* electron=getenv("BEPCII_INFO.BER_PRB");
134 if(electron){
135 e1=atof(electron);
136 }
137 else{
138 log << MSG::ERROR << "Cannot get beam energy (e-)! Please call online people" << endreq;
139 }
140 char* positron=getenv("BEPCII_INFO.BPR_PRB");
141 if(positron){
142 e2=atof(positron);
143 }
144 else{
145 log << MSG::ERROR << "Cannot get beam energy (e+)! Please call online people" << endreq;
146 }
147 if(e1>0.1&&e2>0.1&&m_beam>0) {
148 m_beam = 0.5*(e1+e2);
149 }
150 else{
151 }
152 log << MSG::INFO << "beam energy = " << m_beam << endreq;
153
154 // Part 1: Get the event header, print out event and run number
155 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
156 if (!eventHeader) {
157 log << MSG::FATAL << "Could not find Event Header" << endreq;
158 return( StatusCode::FAILURE);
159 }
160 //Part 2: Retrieve Hits Collection
161 SmartDataPtr<RecEmcShowerCol> emcShowerCol(eventSvc(),"/Event/Recon/RecEmcShowerCol");
162 if (!emcShowerCol) {
163 log << MSG::FATAL << "Could not find Emc rec!!" << endreq;
164 return( StatusCode::FAILURE);
165 }
166 //Part 3: Calculate acoplanarity of two-max energy showers
167 RecEmcShowerCol::iterator iterShower=emcShowerCol->begin();
168 double max1=-999,max2=-999,max3=-999;
169 double cost1=-999,cost2=-999,cost3=-999,phi1=-999,phi2=-999,phi3=-999;
170
171 unsigned int nshower=emcShowerCol->size();
172 for(;iterShower!= emcShowerCol->end();iterShower++){
173 if((*iterShower)->energy()>=max1){
174 max3=max2;
175 max2=max1;
176 cost3=cost2;
177 cost2=cost1;
178 phi3=phi2;
179 phi2=phi1;
180 max1=(*iterShower)->energy();
181 cost1=cos((*iterShower)->position().theta());
182 phi1=(*iterShower)->position().phi();
183 }
184 else if((*iterShower)->energy()>max2){
185 max3=max2;
186 cost3=cost2;
187 phi3=phi2;
188 max2=(*iterShower)->energy();
189 cost2=cos((*iterShower)->position().theta());
190 phi2=(*iterShower)->position().phi();
191 }
192 else if((*iterShower)->energy()>max3){
193 max3=(*iterShower)->energy();
194 cost3=(*iterShower)->position().theta();
195 phi3=(*iterShower)->position().phi();
196 }
197 }
198 double acop=180,acol=180.;
199 if(nshower>=2){
200 acop=180.-180./3.1415927*acos(cos(phi1)*cos(phi2)+sin(phi1)*sin(phi2));
201 acol=180.-180./3.1415927*acos(cos(phi1)*sin(acos(cost1))*cos(phi2)*sin(acos(cost2))
202 +sin(phi1)*sin(acos(cost1))*sin(phi2)*sin(acos(cost2))
203 +cost1*cost2);
204 }
205
206 log << MSG::INFO << "nshower=" << nshower << "; acop=" << acop
207 <<"; emax1="<< max1 <<"; emax2="<< max2 <<endreq;
208
209 //Part 4: Put the criteria item(s) to HltStoreSvc here
210 m_nshower->setValue(nshower);
211 m_acop->setValue(acop);
212 m_acole->setValue(acol);
213 m_emax1->setValue(max1/abs(m_beam));
214 m_emax2->setValue(max2/abs(m_beam));
215 m_emax3->setValue(max3/abs(m_beam));
216 m_emax12->setValue((max1+max2)/abs(m_beam));
217 m_coste1->setValue(cost1);
218 m_coste2->setValue(cost2);
219 m_coste3->setValue(cost3);
220 m_phi1->setValue(phi1);
221 m_phi2->setValue(phi2);
222 m_phi3->setValue(phi3);
223
224 m_ef->addToEFVec(nshower, 38);
225 m_ef->appToEFVec(max1, 39);
226 m_ef->appToEFVec(cost1,40);
227 m_ef->appToEFVec(phi1,41);
228 m_ef->appToEFVec(max2, 42);
229 m_ef->appToEFVec(cost2,43);
230 m_ef->appToEFVec(phi2,44);
231 m_ef->appToEFVec(acop, 45);
232 m_ef->appToEFVec(acol, 46);
233 m_ef->appToEFVec(max1+max2, 47);
234 m_ef->appToEFVec(max3, 48);
235 m_ef->appToEFVec(cost3,49);
236 m_ef->appToEFVec(phi3,50);
237
238 m_ef->setVecBit(true, 0, 2);
239 if(nshower==0)m_ef->addToEFVec(1<<16,1);
240 else if(nshower==1)m_ef->addToEFVec(4<<16,1);
241 else if(nshower==2)m_ef->addToEFVec(10<<16,1);
242 else if(nshower>=3)m_ef->addToEFVec(13<<16,1);
243 else m_ef->addToEFVec(0<<16,1);
244
245 m_run=1;
246
247 return StatusCode::SUCCESS;
248}
249
251 MsgStream log(msgSvc(), name());
252 log << MSG::INFO << "in finalize()" << endmsg;
253 return StatusCode::SUCCESS;
254}
255
257
258 if(m_run) {
259 m_nshower->reset();
260 m_acop->reset();
261 m_acole->reset();
262 m_emax1->reset();
263 m_emax2->reset();
264 m_emax3->reset();
265 m_emax12->reset();
266 m_coste1->reset();
267 m_coste2->reset();
268 m_coste3->reset();
269 m_phi1->reset();
270 m_phi2->reset();
271 m_phi3->reset();
272 m_run=0;
273 }
274 return;
275}
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
double sin(const BesAngle a)
double cos(const BesAngle a)
virtual ~EFProcessCluster()
EFProcessCluster(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize()
bool addToEFVec(uint32_t val, uint32_t pos)
Definition: EFResult.cxx:81
bool appToEFVec(double val, uint32_t pos)
Definition: EFResult.cxx:68
bool setVecBit(uint32_t val, uint32_t vecpos, uint32_t bbegin, uint32_t bend)
Definition: EFResult.cxx:94
virtual StatusCode initialize()