00001
00002
00003
00004
00005 #include "St2011WMaker.h"
00006
00007 #include "St2011WlumiMaker.h"
00008
00009 ClassImp(St2011WlumiMaker)
00010
00011
00012
00013 St2011WlumiMaker::St2011WlumiMaker(const char *name):StMaker(name){
00014 wMK=0;muMK=0;HList=0;
00015
00016 }
00017
00018
00019
00020
00021 Int_t St2011WlumiMaker::Init(){
00022 assert(wMK);
00023 assert(muMK);
00024 assert(HList);
00025 initHistos();
00026 return StMaker::Init();
00027 }
00028
00029
00030
00031
00032 Int_t St2011WlumiMaker::InitRun (int runumber){
00033 towerInfoIsCurrent=false;
00034 nActiveTowers=0;
00035 for (int i=0;i<16;i++) nBHT3[i]=0;
00036 nBHT3_software_L0=0;
00037 nBHT3_hardware_L0=0;
00038 for (int i=0;i<120;i++)
00039 for (int j=0;j<16;j++)
00040 nBx[j][i]=0;
00041
00042 return 0;
00043 }
00044
00045
00046
00047 Int_t St2011WlumiMaker::FinishRun (int runnumber){
00048
00049 printf("Finishing Run %d (lumi)\n",runnumber);
00050
00051 char runName[9];
00052 sprintf(runName,"%d",runnumber);
00053
00054 float activeFraction=nActiveTowers*1.0/4800.0;
00055 float effective_lumi;
00056 float total_lumi;
00057 int BHT3prescale=50;
00058 int nBHT3triggers;
00059 float BHT3xs=520000;
00060 int nAbortGap1, nAbortGap2;
00061
00062
00063
00064 getAbortGapCounts(0,&nAbortGap1,&nAbortGap2);
00065
00066 hA[19]->Fill(runName,nBHT3_software_L0);
00067 hA[20]->Fill(runName,nBHT3_hardware_L0);
00068 hA[21]->Fill(runName,nAbortGap1);
00069 hA[22]->Fill(runName,nAbortGap2);
00070 nBHT3triggers=(nBHT3_software_L0-nAbortGap1*111.0/11.0-nAbortGap2*109.0/9.0)*BHT3prescale;
00071 hA[23]->Fill(runName,nBHT3triggers);
00072
00073 effective_lumi=nBHT3triggers*1.0/BHT3xs;
00074 hA[24]->Fill(runName,effective_lumi);
00075
00076
00077
00078
00079
00080 total_lumi=effective_lumi/activeFraction;
00081 hA[16]->Fill(runName,total_lumi);
00082 hA[17]->Fill(runName,activeFraction);
00083 hA[18]->Fill(runName,nAbortGap1*120/11+nAbortGap2*120/9);
00084 printf("eff_lumi=%f, active=%2.2f, nTowers=%d\n",effective_lumi,activeFraction,nActiveTowers);
00085
00086 for (int i=0;i<16;i++)
00087 {
00088
00089 hA[25]->Fill(i,nBHT3[i]);
00090 hA[30+i]->Fill(runName,nBHT3[i]);
00091 getAbortGapCounts(i,&nAbortGap1,&nAbortGap2);
00092 hA[50+i]->Fill(runName,nAbortGap1);
00093 hA[70+i]->Fill(runName,nAbortGap2);
00094 }
00095
00096 TH1F* temp;
00097 temp=(TH1F*)(HList->FindObject("muWET"));
00098 hA[5]->Add(temp,1.0/activeFraction);
00099
00100
00101
00102
00103
00104 return 0;
00105 }
00106
00107
00108
00109 Int_t
00110 St2011WlumiMaker::Make(){
00111
00112
00113
00114
00115 if (!towerInfoIsCurrent) getActiveTowers();
00116
00117
00118 sortTrigger();
00119
00120
00121 return kStOK;
00122 }
00123
00124
00125
00126 void
00127 St2011WlumiMaker::getActiveTowers(){
00128
00129 nActiveTowers=0;
00130 WeveBEMC *barrel=&(wMK->wEve->bemc);
00131 for (int i=0;i<4800;i++)
00132 if (barrel->statTile[0][i]==0)
00133 nActiveTowers++;
00134
00135
00136
00137 if (nActiveTowers>0) towerInfoIsCurrent=true;
00138 return;
00139 }
00140
00141
00142
00143 void
00144 St2011WlumiMaker::sortTrigger(){
00145 int thresh[16];
00146 thresh[0]=-1;
00147 thresh[1]=14;
00148 thresh[2]=36;
00149 thresh[3]=56;
00150 thresh[4]=78;
00151 thresh[5]=98;
00152 thresh[6]=119;
00153 thresh[7]=139;
00154 thresh[8]=161;
00155 thresh[9]=181;
00156 thresh[10]=201;
00157 thresh[11]=222;
00158 thresh[12]=243;
00159 thresh[13]=263;
00160 thresh[14]=283;
00161 thresh[15]=306;
00162
00163
00164
00165 Wevent2011 *weve=wMK->wEve;
00166
00167 if (weve->l2bitET) {
00168
00169 hA[0]->Fill("L2W",1);
00170 hA[0]->Fill("L2Wnormal",1);
00171 }
00172 if (weve->l2bitRnd) {
00173
00174 hA[0]->Fill("L2W",1);
00175 hA[0]->Fill("L2Wrandom",1);
00176 nBHT3_hardware_L0++;
00177 if (wMK->passes_L0())
00178 {
00179 nBHT3_software_L0++;
00180 hA[1]->Fill(weve->bx7);
00181
00182 for (int i=0;i<16;i++)
00183 {
00184
00185 if (weve->trigAwaySum[i]>thresh[i])
00186 {
00187
00188 nBHT3[i]++;
00189
00190 nBx[i][weve->bx7]++;
00191 }
00192 }
00193 }
00194 }
00195
00196
00197
00198 return;
00199 }
00200
00201
00202
00203 void
00204 St2011WlumiMaker::getAbortGapCounts(int angle, int *n1, int* n2){
00205
00206
00207 *n1=0;
00208 for (int i=32;i<=39;i++)
00209 *n1+=nBx[angle][i];
00210 *n2=0;
00211 for (int i=112;i<=119;i++)
00212 *n2+=nBx[angle][i];
00213 return;
00214 }
00215
00216
00217
00218
00219