BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
DigammaPreSelect Class Reference

#include <DigammaPreSelect.h>

+ Inheritance diagram for DigammaPreSelect:

Public Member Functions

 DigammaPreSelect (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
int selectedType () const
 
int selectedTrkID1 () const
 
int selectedTrkID2 () const
 
 DigammaPreSelect (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
int selectedType () const
 
int selectedTrkID1 () const
 
int selectedTrkID2 () const
 

Detailed Description

Constructor & Destructor Documentation

◆ DigammaPreSelect() [1/2]

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

Definition at line 41 of file DigammaPreSelect.cxx.

41 :
42 Algorithm(name, pSvcLocator) {
43
44 //Declare the properties
45
46 declareProperty ("Vr0cut", m_vr0cut=1.0); // suggest cut: |z0|<5cm && r0<1cm
47 declareProperty ("Vz0cut", m_vz0cut=5.0);
48
49 declareProperty ("lowEnergyShowerCut", m_lowEnergyShowerCut=0.1);
50 declareProperty ("highEnergyShowerCut", m_highEnergyShowerCut=0.5);
51 declareProperty ("matchThetaCut", m_matchThetaCut = 0.2);
52 declareProperty ("matchPhiCut", m_matchPhiCut = 0.2);
53
54 declareProperty ("highMomentumCut", m_highMomentumCut = 0.5);
55 declareProperty ("EoPMaxCut", m_EoPMaxCut =1.3);
56 declareProperty ("EoPMinCut", m_EoPMinCut = 0.6);
57 declareProperty ("minAngShEnergyCut", m_minAngShEnergyCut = 0.2);
58 declareProperty ("minAngCut", m_minAngCut = 0.3);
59 declareProperty ("acolliCut", m_acolliCut = 0.03);
60 declareProperty ("eNormCut", m_eNormCut = 0.5);
61 declareProperty ("pNormCut", m_pNormCut = 0.5);
62 declareProperty ("BarrelOrEndcap", m_BarrelOrEndcap = 1);
63 declareProperty ("Output", m_output = false);
64 declareProperty ("oneProngMomentumCut", m_oneProngMomentumCut =1.2);
65
66 }

◆ DigammaPreSelect() [2/2]

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

Member Function Documentation

◆ execute() [1/2]

StatusCode DigammaPreSelect::execute ( )

Definition at line 136 of file DigammaPreSelect.cxx.

136 {
137
138 setFilterPassed(false);
139
140 MsgStream log(msgSvc(), name());
141 log << MSG::INFO << "in execute()" << endreq;
142
143 m_events++;
144
145 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
146 if(!eventHeader)
147 {
148 cout<<" eventHeader "<<endl;
149 return StatusCode::FAILURE;
150 }
151
152 int run=eventHeader->runNumber();
153 int event=eventHeader->eventNumber();
154 if(event%1000==0) cout<<" run,event: "<<run<<","<<event<<endl;
155
156 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
157 if(!evtRecEvent ) {
158 cout<<" evtRecEvent "<<endl;
159 return StatusCode::FAILURE;
160 }
161
162 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
163 << evtRecEvent->totalCharged() << " , "
164 << evtRecEvent->totalNeutral() << " , "
165 << evtRecEvent->totalTracks() <<endreq;
166 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
167 if(!evtRecTrkCol){
168 cout<<" evtRecTrkCol "<<endl;
169 return StatusCode::FAILURE;
170 }
171
172 Vint iGood;
173 iGood.clear();
174
175 double ene5x5,theta,phi,eseed;
176 double showerX,showerY,showerZ;
177 long int thetaIndex,phiIndex;
178
179 RecEmcID showerId;
180 unsigned int npart;
181
182 Vint ipip, ipim;
183 ipip.clear();
184 ipim.clear();
185 Vp4 ppip, ppim;
186 ppip.clear();
187 ppim.clear();
188
189 vector<RecEmcShower* > GoodShowers;
190 GoodShowers.clear();
191 double etot=0;
192 for(int i = 0; i< evtRecEvent->totalTracks(); i++) {
193 if(i>=evtRecTrkCol->size()) break;
194 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
195 if((*itTrk)->isEmcShowerValid()) {
196 RecEmcShower *theShower = (*itTrk)->emcShower();
197 etot+=theShower->e5x5();
198 showerId = theShower->getShowerId();
199 npart = EmcID::barrel_ec(showerId);
200 ene5x5=theShower->e5x5();
201 thetaIndex=EmcID::theta_module(showerId);
202 phiIndex=EmcID::phi_module(showerId);
203 if (ene5x5>0.4&&ene5x5<4&&npart==1&&(m_BarrelOrEndcap==1)){
204 GoodShowers.push_back(theShower);
205 iGood.push_back((*itTrk)->trackId());
206 }
207 else if (ene5x5>0.4&&ene5x5<4&&(npart==2||npart==0)&&(m_BarrelOrEndcap==2)){
208 GoodShowers.push_back(theShower);
209 iGood.push_back((*itTrk)->trackId());
210 }
211 else if (ene5x5>0.4&&ene5x5<4&&(m_BarrelOrEndcap==0)){
212 GoodShowers.push_back(theShower);
213 iGood.push_back((*itTrk)->trackId());
214 }
215 }
216 // good photon cut will be set here
217 }
218 // Finish Good Photon Selection
219 //
220
221 double MaxE(0), MaxPhi, MaxThe;
222 int MaxId;
223 double SecE(0), SecPhi, SecThe;
224 for(int i=0; i<GoodShowers.size(); i++) {
225 RecEmcShower *theShower = GoodShowers[i];
226 double eraw = theShower->energy();
227 if(eraw> MaxE) {
228 MaxId =i;
229 MaxE =eraw;
230 MaxPhi = theShower->phi();
231 MaxThe = theShower->theta();
232 }
233 }
234 for(int i=0; i<GoodShowers.size(); i++) {
235 RecEmcShower *theShower = GoodShowers[i];
236 double eraw = theShower->energy();
237 if(i!=MaxId&&eraw>SecE) {
238 SecE =eraw;
239 SecPhi = theShower->phi();
240 SecThe = theShower->theta();
241 }
242 }
243
244 double dphi = (fabs(MaxPhi-SecPhi)-PI)*180./PI;
245 double dthe = (fabs(MaxThe+SecThe)-PI)*180./PI;
246 if(GoodShowers.size()>=2&&SecE>1.0&&dphi>-4&&dphi<2&&abs(dthe)<3&&etot>2.7) {
247 setFilterPassed(true);
248 selected++;
249 }
250
251 if(m_output) {
252 m_etot=etot;
253 m_sh1_ene = MaxE;
254 m_sh1_theta = MaxThe;
255 m_sh1_phi = MaxPhi;
256 m_sh2_ene = SecE;
257 m_sh2_theta = SecThe;
258 m_sh2_phi = SecPhi;
259 m_di_phi = dphi;
260 m_di_the = dthe;
261 m_tuple1->write();
262 }
263
264 return StatusCode::SUCCESS;
265
266}
int selected
Double_t etot
std::vector< HepLorentzVector > Vp4
Definition: Gam4pikp.cxx:53
std::vector< int > Vint
Definition: Gam4pikp.cxx:52
const double PI
Definition: PipiJpsi.cxx:55
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition: EmcID.cxx:38
static unsigned int theta_module(const Identifier &id)
Definition: EmcID.cxx:43
static unsigned int phi_module(const Identifier &id)
Definition: EmcID.cxx:48

◆ execute() [2/2]

StatusCode DigammaPreSelect::execute ( )

◆ finalize() [1/2]

StatusCode DigammaPreSelect::finalize ( )

Definition at line 269 of file DigammaPreSelect.cxx.

269 {
270
271 MsgStream log(msgSvc(), name());
272 log << MSG::INFO << "in finalize()" << endmsg;
273 cout<<"total events: "<<m_events<<endl;
274 cout<<"selected digamma: "<<selected<<endl;
275
276 return StatusCode::SUCCESS;
277}

◆ finalize() [2/2]

StatusCode DigammaPreSelect::finalize ( )

◆ initialize() [1/2]

StatusCode DigammaPreSelect::initialize ( )

Definition at line 69 of file DigammaPreSelect.cxx.

69 {
70 MsgStream log(msgSvc(), name());
71
72 log << MSG::INFO << "in initialize()" << endmsg;
73
74 if(m_output) {
75 StatusCode status;
76 NTuplePtr nt1(ntupleSvc(), "FILE1/bhabha");
77 if ( nt1 ) m_tuple1 = nt1;
78 else {
79 m_tuple1 = ntupleSvc()->book ("FILE1/bhabha", CLID_ColumnWiseTuple, "N-Tuple example");
80 if ( m_tuple1 ) {
81 status = m_tuple1->addItem ("sh1_ene",m_sh1_ene);
82 status = m_tuple1->addItem ("sh1_theta", m_sh1_theta);
83 status = m_tuple1->addItem ("sh1_phi", m_sh1_phi);
84 status = m_tuple1->addItem ("sh2_ene",m_sh2_ene);
85 status = m_tuple1->addItem ("sh2_theta", m_sh2_theta);
86 status = m_tuple1->addItem ("sh2_phi", m_sh2_phi);
87 status = m_tuple1->addItem ("di_phi", m_di_phi);
88 status = m_tuple1->addItem ("di_the", m_di_the);
89 status = m_tuple1->addItem ("acolli", m_acolli);
90 status = m_tuple1->addItem ("mdc_hit", m_mdc_hit);
91 status = m_tuple1->addItem ("etot", m_etot);
92
93 }
94 else {
95 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple1) << endmsg;
96 return StatusCode::FAILURE;
97 }
98 }
99
100
101 NTuplePtr nt2(ntupleSvc(), "FILE1/bha1");
102 if ( nt2 ) m_tuple2 = nt2;
103 else {
104 m_tuple2 = ntupleSvc()->book ("FILE1/bha1", CLID_ColumnWiseTuple, "N-Tuple example");
105 if ( m_tuple2 ) {
106 status = m_tuple2->addItem ("sh_ene",m_sh_ene);
107 status = m_tuple2->addItem ("sh_theta", m_sh_theta);
108 status = m_tuple2->addItem ("sh_phi", m_sh_phi);
109 }
110 else {
111 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple2) << endmsg;
112 return StatusCode::FAILURE;
113 }
114 }
115 }
116
117
118 //
119 //--------end of book--------
120 //
121
122 m_rejected=0;
123 m_events=0;
124 m_oneProngsSelected=0;
125 m_twoProngsMatchedSelected=0;
126 m_twoProngsOneMatchedSelected=0;
127 m_selectedTrkID1=999;
128 m_selectedTrkID2=999;
129
130 log << MSG::INFO << "successfully return from initialize()" <<endmsg;
131 return StatusCode::SUCCESS;
132
133}

◆ initialize() [2/2]

StatusCode DigammaPreSelect::initialize ( )

◆ selectedTrkID1() [1/2]

int DigammaPreSelect::selectedTrkID1 ( ) const
inline

Definition at line 23 of file EvtPreSelect/DigammaPreSelect/DigammaPreSelect-00-00-02/DigammaPreSelect/DigammaPreSelect.h.

24 {
25 return m_selectedTrkID1;
26 }

◆ selectedTrkID1() [2/2]

int DigammaPreSelect::selectedTrkID1 ( ) const
inline

Definition at line 23 of file InstallArea/include/DigammaPreSelect/DigammaPreSelect/DigammaPreSelect.h.

24 {
25 return m_selectedTrkID1;
26 }

◆ selectedTrkID2() [1/2]

int DigammaPreSelect::selectedTrkID2 ( ) const
inline

Definition at line 27 of file EvtPreSelect/DigammaPreSelect/DigammaPreSelect-00-00-02/DigammaPreSelect/DigammaPreSelect.h.

28 {
29 return m_selectedTrkID2;
30 }

◆ selectedTrkID2() [2/2]

int DigammaPreSelect::selectedTrkID2 ( ) const
inline

Definition at line 27 of file InstallArea/include/DigammaPreSelect/DigammaPreSelect/DigammaPreSelect.h.

28 {
29 return m_selectedTrkID2;
30 }

◆ selectedType() [1/2]

int DigammaPreSelect::selectedType ( ) const
inline

Definition at line 19 of file EvtPreSelect/DigammaPreSelect/DigammaPreSelect-00-00-02/DigammaPreSelect/DigammaPreSelect.h.

20 {
21 return m_selectedType;
22 }

◆ selectedType() [2/2]

int DigammaPreSelect::selectedType ( ) const
inline

Definition at line 19 of file InstallArea/include/DigammaPreSelect/DigammaPreSelect/DigammaPreSelect.h.

20 {
21 return m_selectedType;
22 }

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