00001
00002
00003
00004
00005 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
00006 #include <StMuDSTMaker/COMMON/StMuDst.h>
00007 #include <StMuDSTMaker/COMMON/StMuEvent.h>
00008 #include <StEvent/StEventInfo.h>
00009 #include "StSpinPool/StSpinDbMaker/StSpinDbMaker.h"
00010
00011 #include "St2011WMaker.h"
00012
00013 #include "St2011pubSpinMaker.h"
00014
00015 ClassImp(St2011pubSpinMaker)
00016
00017
00018
00019 St2011pubSpinMaker::St2011pubSpinMaker(const char *name):StMaker(name){
00020 wMK=0;HList=0;
00021 core=name;
00022 par_QPTlow=0.010;
00023
00024 par_QPThighET0=25;
00025 par_QPThighET1=50;
00026 par_QPThighA=0.08;
00027 par_QPThighB=0.0013;
00028 par_leptonEta1=-1.; par_leptonEta2=1.;
00029 par_useNoEEMC=0;
00030 }
00031
00032
00033
00034
00035 Int_t
00036 St2011pubSpinMaker::Init(){
00037 assert(wMK);
00038 assert(HList);
00039 initHistos();
00040 nRun=0;
00041 hbxIdeal=0;
00042 return StMaker::Init();
00043 }
00044
00045
00046
00047
00048 Int_t
00049 St2011pubSpinMaker::FinishRun (int runNo){
00050 char txt[1000];
00051 sprintf(txt,"events T= %d %d",Tfirst,Tlast);
00052 printf("Finish run=%d , events time range %s\n",runNo,txt);
00053 hbxIdeal->GetYaxis()->SetTitle(txt);
00054 return kStOK;
00055 }
00056
00057
00058
00059 Int_t
00060 St2011pubSpinMaker::InitRun (int runNo){
00061 assert(runNo>= 10081007);
00062 assert(runNo<=10103046);
00063
00064 char txt[1000],txt0[100];
00065 sprintf(txt0,"bxIdeal%d",nRun);
00066 sprintf(txt,"intended fill pattern R%d-%d vs. bXing; %s", runNo,nRun,spinDb->getV124comment());
00067 nRun++;
00068 Tfirst=int(2e9); Tlast=-Tfirst;
00069 hbxIdeal=new TH1F(core+txt0,txt,128,-0.5,127.5);
00070 hbxIdeal->SetFillColor(kYellow);
00071 HList->Add(hbxIdeal);
00072
00073 spinDb->print(0);
00074 for(int bx=0;bx<120;bx++){
00075 if(spinDb->isBXfilledUsingInternalBX(bx)) hbxIdeal->Fill(bx);
00076 }
00077
00078 sprintf(txt,"bXing= bx48+off=%d",spinDb->BX48offset());
00079 hA[3]->GetXaxis()->SetTitle(txt);
00080
00081 sprintf(txt,"bXing= bx7+off=%d",spinDb->BX7offset());
00082 hA[4]->GetXaxis()->SetTitle(txt);
00083
00084 LOG_INFO<<Form("::InitRun(%d) done, W-spin sorting params: exclude |Q/PT| < %.2f OR |Q/PT| above line %.3f*(ET-%.1f)-%6e if ET<%.1f, for AL use leptonEta in[%.1f,%.1f] useNoEEMC=%d", runNo,
00085 par_QPTlow,par_QPThighET0, par_QPThighA ,par_QPThighB,par_QPThighET1,par_leptonEta1, par_leptonEta2,par_useNoEEMC
00086 )<<endm;
00087 return kStOK;
00088 }
00089
00090
00091
00092 Int_t
00093 St2011pubSpinMaker::Make(){
00094 int T=wMK->mMuDstMaker->muDst()->event()->eventInfo().time();
00095 if(Tlast<T) Tlast=T;
00096 if(Tfirst>T) Tfirst=T;
00097
00098 bXingSort();
00099 return kStOK;
00100 }
00101
00102
00103
00104 void
00105 St2011pubSpinMaker::bXingSort(){
00106
00107
00108 hA[0]->Fill("inp",1.);
00109
00110 assert(spinDb->isValid());
00111 assert(spinDb->isPolDirLong());
00112
00113 if(wMK->wEve->vertex.size()<=0) return;
00114
00115
00116 int bx48=wMK->wEve->bx48;
00117 int bx7=wMK->wEve->bx7;
00118 if(spinDb->offsetBX48minusBX7(bx48,bx7)) {
00119 printf("BAD bx7=%d bx48=%d del=%d\n",bx7,bx48,spinDb->offsetBX48minusBX7(bx48,bx7));
00120 hA[0]->Fill("badBx48",1.);
00121 return;
00122 }
00123
00124
00125 if(wMK->wEve->zTag) return;
00126 hA[0]->Fill("noZ",1.);
00127
00128
00129 hA[1]->Fill(bx48);
00130 hA[2]->Fill(bx7);
00131
00132 int bxStar48= spinDb->BXstarUsingBX48(bx48);
00133 int bxStar7=spinDb->BXstarUsingBX7(bx7);
00134 hA[3]->Fill(bxStar48);
00135 hA[4]->Fill(bxStar7);
00136
00137 int spin4=spinDb->spin4usingBX48(bx48);
00138 hA[5]->Fill(bxStar7,spin4);
00139
00140 float par_maxDsmThr=58;
00141 float par_myET=25;
00142 if( wMK->wEve->l2bitRnd) {
00143 StMuEvent* muEve = wMK->mMuDstMaker->muDst()->event();
00144 int max=0;
00145 for (int m=0;m<300;m++) {
00146 int val=muEve->emcTriggerDetector().highTower(m);
00147 if(max<val) max=val;
00148 }
00149
00150 if(max<par_maxDsmThr) { hA[6]->Fill(spin4); hA[0]->Fill("BG1",1.);}
00151 return;
00152 }
00153
00154 if( wMK->wEve->l2bitET==0) return;
00155
00156
00157
00158
00159 for(uint iv=0;iv<wMK->wEve->vertex.size();iv++) {
00160 WeveVertex &V=wMK->wEve->vertex[iv];
00161 for(uint it=0;it<V.eleTrack.size();it++) {
00162 WeveEleTrack &T=V.eleTrack[it];
00163 if(T.pointTower.id==0) continue;
00164
00165
00166 float frac24=T.cluster.ET/(T.cl4x4.ET);
00167 if(iv==0 && it==0 && frac24<wMK->par_clustFrac24) {
00168 hA[31]->Fill(T.cluster.ET);
00169 if( T.cluster.ET <20. ) { hA[7]->Fill(spin4); hA[0]->Fill("BG2",1.);}
00170 }
00171
00172 if(T.isMatch2Cl==false) continue;
00173 assert(T.cluster.nTower>0);
00174 assert(T.nearTotET>0);
00175
00176 int iQ=0;
00177 float p_Q=T.prMuTrack->charge();
00178 if( p_Q<0 ) iQ=1;
00179 float ET=T.cluster.ET;
00180
00181
00182
00183 bool isW= T.cluster.ET /T.nearTotET> wMK->par_nearTotEtFrac;
00184 if(par_useNoEEMC)
00185 isW=isW && T.sPtBalance_noEEMC>wMK->par_ptBalance;
00186 else
00187 isW=isW && T.sPtBalance>wMK->par_ptBalance;
00188
00189 if(!isW) {
00190 if(ET>15 &&ET<20 ) hA[16+iQ]->Fill(spin4);
00191 continue;
00192 }
00193
00194 hA[0]->Fill("Wcut",1.);
00195
00196 hA[30]->Fill(T.prMuTrack->eta());
00197 if(fabs(T.primP.Eta()) > wMK->par_leptonEta) continue;
00198
00199 if(T.prMuTrack->eta()<par_leptonEta1) continue;
00200 if(T.prMuTrack->eta()>par_leptonEta2) continue;
00201 hA[0]->Fill("eta",1.);
00202
00203
00204
00205
00206
00207 if(ET>par_myET) hA[0]->Fill("W25",1.);
00208 float q2pt=T.prMuTrack->charge()/T.prMuTrack->pt();
00209 if(ET>par_myET) hA[8]->Fill(q2pt);
00210 hA[9]->Fill(ET,q2pt);
00211
00212
00213 if( fabs(q2pt)< par_QPTlow) continue;
00214 if(ET>par_myET) hA[0]->Fill("Qlow",1.);
00215
00216 if(par_QPTlow>0) {
00217 if( fabs(q2pt)< par_QPTlow) continue;
00218 float highCut=par_QPThighA - (ET-par_QPThighET0)*par_QPThighB;
00219
00220 if( ET>par_myET && ET<par_QPThighET1 && fabs(q2pt)>highCut) continue;
00221 }
00222
00223 if(ET>par_myET) {
00224 hA[0]->Fill("Qhigh",1.);
00225 if(p_Q>0) hA[0]->Fill("Q +",1.);
00226 else hA[0]->Fill("Q -",1.);
00227 }
00228
00229
00230 hA[10+iQ]->Fill(ET);
00231 if(ET>25 &&ET<50 ) hA[12+iQ]->Fill(spin4);
00232 if(ET>32 &&ET<44 ) hA[14+iQ]->Fill(spin4);
00233
00234 hA[18+iQ]->Fill(spin4,ET);
00235
00236 }
00237 }
00238
00239 }
00240
00241
00242
00243
00244
00245