BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
Pi0Cut.h
Go to the documentation of this file.
1#ifndef __PI0SELECTOR__H
2#define __PI0SELECTOR__H
3
5#include "BesDChain/CDPi0.h"
9
10struct UserPi0Cut : public DCSelectionFunction<CDPi0>
11{
12 UserPi0Cut(double MEBP = 0.025, double MEEP = 0.045,
13 double MA = 20.,
14 double TL = 25.,
15 double MinM = 0.12, double MaxM = 0.15,
16 double c = 1e+10)
18 MinAngle(MA),
19 TimeLimit(TL),
20 Chisq(c),
21 MinMass(MinM), MaxMass(MaxM)
22 {}
23
26 double MinAngle;
27 double TimeLimit;
28 double MinMass;
29 double MaxMass;
30 double Chisq;
31
32 bool operator()(CDPi0& _this)
33 {
34 EvtRecTrack* g1 = const_cast<EvtRecTrack*>(_this.navPi0()->hiEnGamma());
35 EvtRecTrack* g2 = const_cast<EvtRecTrack*>(_this.navPi0()->loEnGamma());
36 if(!isGoodPhoton(g1)) return false;
37 if(!isGoodPhoton(g2)) return false;
38 if(_this.navPi0()->chisq() > Chisq) return false;
39 if(_this.navPi0()->unconMass() < MinMass || _this.navPi0()->unconMass() > MaxMass) return false;
40 return true;
41 }
42
44 {
45 if ( !gTrk->isEmcShowerValid() ) return false;
46
47 RecEmcShower *emcTrk = gTrk->emcShower();
48 //check time
49 if(emcTrk->time() > TimeLimit) return false;
50 //check energy
51 int flag =(emcTrk->cellId() & 0x000F0000) >> 16;
52 if ((flag == 1) && emcTrk->energy() < MinEnergyOfBarrelPhoton) return false;
53 if ((flag == 0 || flag == 2) && emcTrk->energy() < MinEnergyOfEndcapPhoton) return false;
54 //check angle
55 Hep3Vector emcpos(emcTrk->x(), emcTrk->y(), emcTrk->z());
56 if (recEvt->totalCharged() > 0)
57 {
58 double dthe = 200.;
59 double dphi = 200.;
60 double dang1 = 200.;
61 for (int j = 0; j < recEvt->totalCharged(); j++) {
62 EvtRecTrackIterator jtTrk = recTrkCol->begin() + j;
63 if ( !(*jtTrk)->isExtTrackValid() ) continue;
64 RecExtTrack* extTrk = (*jtTrk)->extTrack();
65 if ( extTrk->emcVolumeNumber() == -1 ) continue;
66 Hep3Vector extpos = extTrk->emcPosition();
67 double angd1 = extpos.angle(emcpos);
68 double thed = extpos.theta() - emcpos.theta();
69 double phid = extpos.deltaPhi(emcpos);
70 thed = fmod(thed+CLHEP::twopi+CLHEP::twopi+CLHEP::pi, CLHEP::twopi) - CLHEP::pi;
71 phid = fmod(phid+CLHEP::twopi+CLHEP::twopi+CLHEP::pi, CLHEP::twopi) - CLHEP::pi;
72
73 if ( fabs(thed) < fabs(dthe) ) dthe = thed;
74 if ( fabs(phid) < fabs(dphi) ) dphi = phid;
75 if ( angd1 < dang1 ) dang1 = angd1;
76 }
77 if ( dang1 < 200 ) {
78 dthe = dthe * 180 / (CLHEP::pi);
79 dphi = dphi * 180 / (CLHEP::pi);
80 dang1 = dang1 * 180 / (CLHEP::pi);
81 if ( dang1 < MinAngle) return false;
82
83
84 } // End of "dang1 < 200" IF
85
86 } // End of "recEv
87 return true;
88 }
89 public:
90 static void SetForTrack(EvtRecEvent* _recEvt, EvtRecTrackCol* _recTrkCol){ recEvt =_recEvt; recTrkCol=_recTrkCol;}
93};
94namespace Pi0{
97}
98#endif
EvtRecTrackCol::iterator EvtRecTrackIterator
Definition: EvtRecTrack.h:111
ObjectVector< EvtRecTrack > EvtRecTrackCol
Definition: EvtRecTrack.h:109
Definition: CDPi0.h:56
virtual const EvtRecPi0 * navPi0() const
Definition: CDPi0.cxx:103
int cellId() const
Definition: DstEmcShower.h:32
double x() const
Definition: DstEmcShower.h:35
double time() const
Definition: DstEmcShower.h:50
double z() const
Definition: DstEmcShower.h:37
double energy() const
Definition: DstEmcShower.h:45
double y() const
Definition: DstEmcShower.h:36
const Hep3Vector emcPosition() const
Definition: DstExtTrack.h:126
const int emcVolumeNumber() const
Definition: DstExtTrack.h:132
int totalCharged() const
Definition: EvtRecEvent.h:24
double unconMass() const
Definition: EvtRecPi0.h:24
const EvtRecTrack * loEnGamma() const
Definition: EvtRecPi0.h:31
double chisq() const
Definition: EvtRecPi0.h:25
const EvtRecTrack * hiEnGamma() const
Definition: EvtRecPi0.h:30
RecEmcShower * emcShower()
Definition: EvtRecTrack.h:58
bool isEmcShowerValid()
Definition: EvtRecTrack.h:47
UserPi0Cut VeryLoosePi0Cut
UserPi0Cut DefaultPi0Cut
Definition: Pi0Cut.cxx:8
double MinAngle
Definition: Pi0Cut.h:26
double MinEnergyOfEndcapPhoton
Definition: Pi0Cut.h:25
bool operator()(CDPi0 &_this)
Definition: Pi0Cut.h:32
static EvtRecEvent * recEvt
Definition: Pi0Cut.h:91
bool isGoodPhoton(EvtRecTrack *gTrk)
Definition: Pi0Cut.h:43
double MinMass
Definition: Pi0Cut.h:28
double MaxMass
Definition: Pi0Cut.h:29
UserPi0Cut(double MEBP=0.025, double MEEP=0.045, double MA=20., double TL=25., double MinM=0.12, double MaxM=0.15, double c=1e+10)
Definition: Pi0Cut.h:12
double TimeLimit
Definition: Pi0Cut.h:27
double MinEnergyOfBarrelPhoton
Definition: Pi0Cut.h:24
static void SetForTrack(EvtRecEvent *_recEvt, EvtRecTrackCol *_recTrkCol)
Definition: Pi0Cut.h:90
double Chisq
Definition: Pi0Cut.h:30
static EvtRecTrackCol * recTrkCol
Definition: Pi0Cut.h:92