7 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
8 #include <StMuDSTMaker/COMMON/StMuDst.h>
9 #include <StMuDSTMaker/COMMON/StMuEvent.h>
10 #include <StMuDSTMaker/COMMON/StMuTriggerIdCollection.h>
12 #include <StSpinPool/StSpinDbMaker/StSpinDbMaker.h>
13 #include <StMuDSTMaker/COMMON/StMuPrimaryVertex.h>
15 #include "St2009WMaker.h"
17 #include "St2009WjjMaker.h"
18 #include <StSpinPool/StJets/StJet.h>
28 par_jetPtLow=5.; par_jetPtHigh=60.;
29 par_jetEtaLow=1.0; par_jetEtaHigh=1.8;
31 par_djPtLow=1.; par_djPtHigh=40;
32 par_djPzLow=3; par_djPzHigh=90;
34 par_etaSumLow=0.01; par_etaSumHigh=2.5;
41 mJEScorrFile=
"fixMe"; memset(mJEScorrH,0,
sizeof(mJEScorrH));
48 St2009WjjMaker::Init(){
54 LOG_INFO<<
GetName()<<Form(
"::Init JES corr=%d, input=%s",par_corLevel,mJEScorrFile.Data())<<endl;;
56 TFile *fd=
new TFile(mJEScorrFile); assert(fd);
57 for(
int i=0;i<mxJESeta;i++) {
58 TString tit=
"jesCorr_iEta"; tit+=i;
59 mJEScorrH[i]=(TH1F*)fd->Get(tit); assert(mJEScorrH[i]);
60 mJEScorrH[i]->Print();
64 TAxis *ax=h->GetXaxis();
int nb=ax->GetNbins();
65 for(
int k=1;k<=nb-1;k++) {
66 float x1=ax->GetBinCenter(k);
67 float x2=ax->GetBinCenter(k+1);
68 float y1=h->GetBinContent(k);
69 float y2=h->GetBinContent(k+1);
70 float tg=(y2-y1)/(x2-x1);
76 return StMaker::Init();
82 St2009WjjMaker::trueJet( TLorentzVector rJ) {
83 if (par_corLevel==0)
return rJ;
84 int iEta=(rJ.Eta()+1.2)/0.4;
86 if(iEta>=mxJESeta ) iEta=mxJESeta-1;
87 TH1F* h=mJEScorrH[iEta];
89 int bin=h->FindBin(rPt);
90 float x1=h->GetBinCenter(bin);
94 x1=h->GetBinCenter(bin);
96 float y1=h->GetBinContent(bin);
97 float tg=h->GetBinError(bin);
99 float truePt=y1+ tg*(rPt-x1);
101 float fac=truePt/rJ.Pt();
112 St2009WjjMaker::FinishRun (
int runNo){
116 sprintf(txt,
"events T= %d %d",Tfirst,Tlast);
117 printf(
"Finish run=%d , events time range %s\n",runNo,txt);
118 hbxIdeal->GetYaxis()->SetTitle(txt);
126 St2009WjjMaker::InitRun (
int runNo){
130 assert(runNo>= 10081007);
131 assert(runNo<=10103046);
133 char txt[1000],txt0[100];
134 sprintf(txt0,
"bxIdeal%d",nRun);
135 sprintf(txt,
"intended fill pattern R%d-%d vs. bXing; %s", runNo,nRun,spinDb->getV124comment());
137 Tfirst=int(2e9); Tlast=-Tfirst;
138 hbxIdeal=
new TH1F(core+txt0,txt,128,-0.5,127.5);
139 hbxIdeal->SetFillColor(kYellow);
140 HList->Add(hbxIdeal);
143 for(
int bx=0;bx<120;bx++){
147 sprintf(txt,
"bXing= bx7+off=%d",spinDb->
BX7offset());
148 hA[4]->GetXaxis()->SetTitle(txt);
152 LOG_INFO<<
GetName()<<Form(
"::InitRun(%d) done, W->jet+jet sorting params: doSpinSort=%d |vertZ|<%.0f cm,\n jetPt=[%.1f,%.1f] GeV/c, jetEta=[%.1f,%.1f]\n DJ: pT=[%.1f,%.1f] GeV/c, |Pz|=[%.1f,%.1f] GeV/c, eta1+2=[%.1f,%.1f]",
153 runNo,par_spinSort,par_vertexZ ,par_jetPtLow,par_jetPtHigh,par_jetEtaLow,par_jetEtaHigh,
154 par_djPtLow,par_djPtHigh,par_djPzLow,par_djPzHigh,par_etaSumLow, par_etaSumHigh
163 int T=wMK->mMuDstMaker->
muDst()->
event()->eventInfo().time();
165 if(Tfirst>T) Tfirst=T;
174 St2009WjjMaker::bXingSort(){
177 hA[0]->Fill(
"inp",1.);
186 vector<unsigned int> idL=l1.triggerIds();
189 for(
unsigned int i=0;i<idL.size(); i++){
190 if(idL[i]==230420) trgOK+=1;
191 if(idL[i]==230411) trgOK+=2;
193 if(trgOK) hA[0]->Fill(
"trig",1.);
198 int nInpPrimV=wMK->mMuDstMaker->
muDst()->numberOfPrimaryVertices();
200 for(
int iv=0;iv<nInpPrimV;iv++) {
205 float rank=V->ranking();
206 if (rank<=0)
continue;
208 if(fabs(r.z()) > par_vertexZ)
continue;
213 hA[0]->Fill(
"vert",1.);
219 if(GetMaker(
"JetReader")==0)
return;
220 TClonesArray* jets = wMK->getJets(
"ConeJets12_100");
222 int nJets= wMK->nJets;
225 hA[0]->Fill(
"anyJ",1.);
227 hA[0]->Fill(
"mulJ",1.);
230 TLorentzVector jet[mxJ];
232 for (
int i_jet=0; i_jet< nJets; i_jet++){
233 TLorentzVector Jreco = *((
StJet*)jets->At(i_jet));
236 TLorentzVector J=Jreco;
239 if(J.Pt()<par_jetPtLow)
continue;
242 hA[0]->Fill(
"J3",1.);
243 hA[6]->Fill(fabs(jet[0].DeltaPhi(J)),fabs(jet[1].DeltaPhi(J)));
247 if(nJ==1)hA[0]->Fill(
"J1",1.);
251 hA[0]->Fill(
"J2",1.);
257 if( fabs(jet[0].Eta()) > fabs(jet[1].Eta()) ) {
258 TLorentzVector J=jet[0];
259 jet[0]=jet[1]; jet[1]=J;
263 hA[10]->Fill(jet[0].Et(),jet[0].Eta());
264 hA[11]->Fill(jet[1].Et(),jet[1].Eta());
265 hA[17]->Fill(jet[0].E(),jet[1].E());
266 hA[18]->Fill(jet[0].Pt(),jet[1].Pt());
267 hA[19]->Fill(jet[0].Eta(),jet[1].Eta());
268 float phiCDdeg=jet[0].DeltaPhi(jet[1])/3.1416*180.;
269 if(phiCDdeg<-90) phiCDdeg+=360;
270 hA[13]->Fill(phiCDdeg);
273 TLorentzVector diJet=jet[0]+jet[1];
274 float invM=sqrt(diJet*diJet);
277 hA[16]->Fill(invM, diJet.Pt());
278 hA[15]->Fill( diJet.Z(),diJet.Pt());
283 hA[21]->Fill(diJet.Pt());
284 hA[22]->Fill(fabs(jet[0].DeltaPhi(jet[1])));
285 hA[23]->Fill(jet[0].Eta()-jet[1].Eta());
286 hA[24]->Fill(jet[0].Eta(),jet[1].Eta());
293 int bx48=wMK->wEve.bx48;
294 int bx7=wMK->wEve.bx7;
295 if(spinDb->offsetBX48minusBX7(bx48,bx7)) {
296 printf(
"BAD bx7=%d bx48=%d del=%d\n",bx7,bx48,spinDb->offsetBX48minusBX7(bx48,bx7));
297 hA[0]->Fill(
"badBx48",1.);
302 hA[4]->Fill(bxStar7);
305 hA[5]->Fill(bxStar7,spin4);
307 hA[20]->Fill(invM,spin4);
321 for (
int i_jet=1; i_jet< nJetsWE; i_jet++){
322 StJet* jet = wMK->getJet(i_jet);
325 float neutral=jet->neutralFraction()*jet->Pt();
326 float charged=jet->chargedFraction()*jet->Pt();
327 neutral=neutral*par_mcJetNeutScale;
328 charged=charged*par_mcJetChrgScale;
329 float sum=neutral+charged;
330 jetVec.SetPtEtaPhi(sum,jet->Eta(),jet->Phi());
331 if(jetVec.DeltaR(T.primP) > par_nearDeltaR)
334 TVector3 clustPt(T.primP.X(),T.primP.Y(),0);
335 clustPt.SetMag(T.cluster.ET);
336 T.ptBalance+=clustPt;
337 T.sPtBalance = T.ptBalance.Perp();
338 if(T.ptBalance.Dot(clustPt)<0) T.sPtBalance *=-1.;
346 int bx48=wMK->wEve.bx48;
347 int bx7=wMK->wEve.bx7;
348 if(spinDb->offsetBX48minusBX7(bx48,bx7)) {
349 printf(
"BAD bx7=%d bx48=%d del=%d\n",bx7,bx48,spinDb->offsetBX48minusBX7(bx48,bx7));
350 hA[0]->Fill(
"badBx48",1.);
358 hA[4]->Fill(bxStar7);
361 hA[5]->Fill(bxStar7,spin4);
367 for (
int m=0;m<300;m++) {
368 int val=muEve->emcTriggerDetector().highTower(m);
static StMuPrimaryVertex * primaryVertex()
return pointer to current primary vertex
bool isBXfilledUsingInternalBX(int bx)
defined only for 2005 run by CAD , based on first 4 filled bunches in both rings. Note...
bool isValid()
dump spinDb content for current time stamp
int spin4usingBX48(int bx48)
8bit spin information
int BX7offset()
bXing at STAR IP, [0,119]
void print(int level=0)
vs. STAR==yellow bXing
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
virtual const char * GetName() const
special overload
int BXstarUsingBX7(int bx7)
bXing at STAR IP, [0,119]
static void setVertexIndex(Int_t vtx_id)
Set the index number of the current primary vertex (used by both primaryTracks() functions and for St...
Collection of trigger ids as stored in MuDst.
bool isPolDirLong()
Returns true if beams are transversely polarized, false otherwise.