CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
LocalPhotonSelector.cxx
Go to the documentation of this file.
1#include "GaudiKernel/Bootstrap.h"
2#include "GaudiKernel/IJobOptionsSvc.h"
3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/PropertyMgr.h"
5#include "GaudiKernel/SmartDataPtr.h"
6
11
13{
14 IJobOptionsSvc* jobSvc;
15 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
16
17 PropertyMgr m_propMgr;
18
19 //Declare the properties
20 m_propMgr.declareProperty("MinEnergy", m_minEnergy = 0.025);
21
22 m_propMgr.declareProperty("InBarrelOrEndcap", m_useBarrelEndcap = true);
23 m_propMgr.declareProperty("MaxCosThetaBarrel", m_maxCosThetaBarrel = 0.8);
24 m_propMgr.declareProperty("MinCosThetaEndcap", m_minCosThetaEndcap = 0.84);
25 m_propMgr.declareProperty("MaxCosThetaEndcap", m_maxCosThetaEndcap = 0.92);
26 m_propMgr.declareProperty("MinEndcapEnergy", m_minEndcapEnergy = 0.050);
27
28 m_propMgr.declareProperty("ApplyTimeCut", m_applyTimeCut = true);
29 m_propMgr.declareProperty("MinTime", m_minTime = 0.);
30 m_propMgr.declareProperty("MaxTime", m_maxTime = 14.);
31 m_propMgr.declareProperty("PhotonDeltaTime", m_deltaTime = 10.);
32
33 m_propMgr.declareProperty("ApplyDangCut", m_applyDangCut = true);
34 m_propMgr.declareProperty("MinDang", m_minDang = 20.0);
35
36 jobSvc->setMyProperties("LocalPhotonSelector", &m_propMgr);
37}
38
40
41 aPhoton.setUserTag(1);
42 SmartDataPtr<EvtRecEvent> recEvt(eventSvc(), EventModel::EvtRec::EvtRecEvent);
43 SmartDataPtr<EvtRecTrackCol> recTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
44
45 EvtRecTrack* recTrk = const_cast<EvtRecTrack*>( aPhoton.photon() );
46
47 if ( !recTrk->isEmcShowerValid() ) return false;
48
49 RecEmcShower *emcTrk = recTrk->emcShower();
50 double eraw = emcTrk->energy();
51 double phi = emcTrk->phi();
52 double the = emcTrk->theta();
53 HepLorentzVector shP4( eraw * sin(the) * cos(phi),
54 eraw * sin(the) * sin(phi),
55 eraw * cos(the),
56 eraw );
57
58 double cosThetaSh = shP4.vect().cosTheta();
59
60
61 /// Minimum energy
62 if (shP4.e() <= m_minEnergy) return false;
63
64
65 /// Barrel/Endcap
66 if ( m_useBarrelEndcap ) {
67 bool inBarrelEndcap = false;
68
69 if(fabs(cosThetaSh) < m_maxCosThetaBarrel) inBarrelEndcap = true;
70
71 if((fabs(cosThetaSh) > m_minCosThetaEndcap)
72 &&(fabs(cosThetaSh) < m_maxCosThetaEndcap)
73 &&(shP4.e() > m_minEndcapEnergy)) inBarrelEndcap = true;
74
75 if ( !inBarrelEndcap ) return false;
76 }
77
78 /// Time, only apply timing cuts if "recEvt->totalCharged() > 0"
79 if ( m_applyTimeCut ) {
80 double time = emcTrk->time();
81 if ( recEvt->totalCharged() > 0 ) {
82 if ( time < m_minTime || time > m_maxTime ) return false;
83 }
84 else {
85 RecEmcShower* firstG = (*(recTrkCol->begin()))->emcShower();
86 double deltaTime = fabs(time - firstG->time());
87 if ( deltaTime > 10 ) return false;
88 }
89 }
90
91 /// Dang
92 if (m_applyDangCut && recEvt->totalCharged() > 0) {
93 Hep3Vector emcpos(emcTrk->x(), emcTrk->y(), emcTrk->z());
94 double dang = 200.;
95
96 for (int j = 0; j < recEvt->totalCharged(); j++) {
97 EvtRecTrackIterator jtTrk = recTrkCol->begin() + j;
98 if ( !(*jtTrk)->isExtTrackValid() ) continue;
99 RecExtTrack* extTrk = (*jtTrk)->extTrack();
100 if ( extTrk->emcVolumeNumber() == -1 ) continue;
101 Hep3Vector extpos = extTrk->emcPosition();
102 double angd1 = extpos.angle(emcpos);
103 if ( angd1 < dang ) dang = angd1;
104 }
105
106 if ( dang < 200 ) {
107 dang = dang * 180 / (CLHEP::pi);
108 if (dang <= m_minDang) return( false );
109 }
110 } // End of "recEvt->totalCharged() > 0" IF
111
112 return true;
113}
114
double sin(const BesAngle a)
Definition BesAngle.h:210
double cos(const BesAngle a)
Definition BesAngle.h:213
Double_t time
EvtRecTrackCol::iterator EvtRecTrackIterator
LocalPhotonSelector photonSelector
IDataProviderSvc * eventSvc()
void setUserTag(int tag)
virtual const EvtRecTrack * photon() const
Definition CDPhoton.cxx:145
double theta() const
double phi() const
double x() const
double time() const
double z() const
double energy() const
double y() const
const Hep3Vector emcPosition() const
const int emcVolumeNumber() const
RecEmcShower * emcShower()
Definition EvtRecTrack.h:70
bool isEmcShowerValid()
Definition EvtRecTrack.h:55
bool operator()(CDPhoton &aPhoton)
_EXTERN_ std::string EvtRecEvent
Definition EventModel.h:134
_EXTERN_ std::string EvtRecTrackCol
Definition EventModel.h:135