BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/Pi0RecAlg/Pi0RecAlg/Pi0Cut.h
Go to the documentation of this file.
1#ifndef __PI0SELECTOR__H
2#define __PI0SELECTOR__H
3
4#include "DecayChain/Function/DCSelectionFunction.h"
5#include "BesDChain/CDPi0.h"
6#include "EvtRecEvent/EvtRecEvent.h"
7#include "EvtRecEvent/EvtRecTrack.h"
8#include "EvtRecEvent/EvtRecPi0.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
TF1 * g1
virtual const EvtRecPi0 * navPi0() const
Definition: CDPi0.cxx:103
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)
static void SetForTrack(EvtRecEvent *_recEvt, EvtRecTrackCol *_recTrkCol)