00001
00002
00003
00004
00005
00006
00008
00009
00010 #include <fstream>
00011 #include "AlephExManager.h"
00012 #include "AlephCollection.h"
00013 #include <vector>
00014
00015 extern ofstream fout;
00016
00017
00019
00021
00022 void AlephExManager::UserInit() {}
00023
00026
00027 float QQRADP = 57.29577951;
00028
00029 struct order
00030 {
00031 bool operator()(QvecBase* a, QvecBase* b)
00032 {
00033 return ((*a) < (*b)) ;
00034 }
00035 };
00037
00039
00040 {
00041
00042 AlephCollection<AlTrack *> altp =EventInfo.TrackPV();
00043 AlephCollection<AlMuon *> almup=EventInfo.MuonPV();
00044 AlephCollection<AlElec *> alelp=EventInfo.ElecPV();
00045 AlephCollection<AlEflw *> alefp=EventInfo.EflwPV();
00046
00047 float QELEP = EventInfo.Event().Energy();
00048
00049 int Nchsel=0;
00050 for (AlephCollection<AlTrack *>::iterator Ich=altp.begin(); Ich<altp.end(); Ich++)
00051 {
00052 int Ntpc = (*Ich)->NT();
00053 float costhch = (*Ich)->QCT();
00054 float d0 = (*Ich) -> QDB();
00055 float z0 = (*Ich) -> QZB();
00056
00057 if ((Ntpc<4)||(costhch>0.95)||(d0>2.)||(z0>10.)
00058 ||(costhch<-.95)||(d0<-2)||(z0<-10))
00059 {
00060 (*Ich)->Lock();
00061 altp.looperase(Ich);
00062 }
00063 else Nchsel++;
00064 }
00065
00066 if (alefp.size()<2) return 0;
00067 if (altp.size()<2) return 0;
00068
00069
00070
00071 AlephCollection<AlTau> JJ = alefp.ATauJn(theCardsReader()->TAIDcuts(),QELEP);
00072 AlephCollection<AlTau*> altaup = JJ.Pointers();
00073
00074
00075 almup.FilterMu(theCardsReader()->MUIDcuts());
00076 cout << " found " << almup.size() << " muon(s)" << endl;
00077
00078
00079 alelp.FilterEl(almup,theCardsReader()->ELIDcuts());
00080 cout << " found " << alelp.size() << " eletron(s)" << endl;
00081
00082
00083 altaup.FilterTau(theCardsReader()->TAIDcuts());
00084 QvecBase::SortCriterium = 0;
00085 sort(altaup.begin(),altaup.end(),order());
00086 AlTau* seltau = NULL;
00087 if(altaup.size()!=0 ) seltau = *(altaup.end()-1);
00088 cerr << " found " << altaup.size() << " tau(s)" << endl;
00089
00090
00091
00092
00093 int jetr;
00094 float Ycut = -2.;
00095 int scheme = 1;
00096 AlephCollection<AlJet> Jn = alefp.DurhamJet(Ycut, scheme, 0);
00097 jetr = Jn.size();
00098 float acopl=180.;
00099 float acolin=90.;
00100 if(jetr == 2)
00101 {
00102 acopl= acos(min(max(cos(Jn[0].QPH()-Jn[1].QPH()),-1.),1.))*QQRADP;
00103 acolin= acos(min(max(Jn[1].QCOSA(Jn[0]),(float)-1.),(float)1.))*QQRADP;
00104 }
00105 cout << "acoplanarity/acolinearity with tau are: " << acopl << " " << acolin << endl;
00106
00107
00108 float acoplww = 180.;
00109 float acolww = 90.;
00110 AlephCollection<AlJet> Jn3;
00111 if(altaup.size())
00112 {
00113
00114 seltau->Lock(1);
00115 int alefpsize=0;
00116 for (AlephCollection<AlEflw*>::iterator i = alefp.begin(); i != alefp.end(); i++)
00117 if (!((*i)->isLocked())) alefpsize++;
00118 if (alefpsize>1)
00119 {
00120 Ycut = -2;
00121 scheme = 1;
00122 Jn3 = alefp.DurhamJet(Ycut, scheme, 0);
00123
00124 if(jetr == 2)
00125 {
00126 float acoplww = 180.;
00127 float acolww = 90.;
00128 acoplww= acos(min(max(cos(Jn3[0].QPH()-Jn3[1].QPH()),-1.),1.))*QQRADP;
00129 acolww= acos(min(max(Jn3[1].QCOSA(Jn3[0]),(float)-1),(float)1))*QQRADP;
00130 cout << "acoplanarity/acolinearity without tau are: " << acoplww << " " << acolww << endl;
00131 }
00132 }
00133 seltau->unLock(1);
00134 }
00135 return true;
00136 }
00137
00140
00142
00144