2 #include "StLuminosityMaker.h"
3 #include "StLuminosityHolder.h"
4 #include "StDetectorDbMaker/StDetectorDbTriggerID.h"
5 #include "StDetectorDbMaker/StDetectorDbBeamInfo.h"
6 #include "StMuDSTMaker/COMMON/StMuDst.h"
7 #include "StMuDSTMaker/COMMON/StMuEvent.h"
8 #include "StEvent/StTriggerId.h"
9 #include "StSpinPool/StTriggerFilterMaker/StTriggerFilterMaker.h"
27 mTriggerSimuMaker = NULL;
32 Int_t StLuminosityMaker::Init()
34 muDstMaker =
dynamic_cast<StMuDstMaker*
>(GetMaker(
"MuDst"));
37 if(!strcmp(runMode,
"")){
38 LOG_ERROR<<
"runMode is not set"<<endm;
42 LOG_INFO<<
"Using minbias cross-section: "<<getCrossSectionNB()<<
" (nb)"<<endm;
44 mLumHolder =
new TClonesArray(
"StLuminosityHolder",20);
46 return StMaker::Init();
49 Int_t StLuminosityMaker::InitRun(
int run)
55 LOG_INFO<<
"Now starting Run#"<<run<<endm;
57 for(
unsigned int i = 0; i < mTriggers.size(); i++){
82 const StTriggerId& trigs = muevent->triggerIdCollection().nominal();
84 for(
unsigned int i = 0; i < mTriggers.size(); i++){
85 if(trigs.isTrigger(mTriggers[i])){
91 if(vertz > 1e-5)mNVertex[i]++;
92 if(mTriggerSimuMaker && !mTriggerSimuMaker->isTrigger(mTriggers[i]))
continue;
94 if(mVertexCut > vertz && vertz > 1e-5){
100 if(mFilterMode && !passvert && !passtrig)
return kStSkip;
105 void StLuminosityMaker::addTrigger(
unsigned int trigId)
107 mTriggers.push_back(trigId);
108 mNTotal.push_back(0);
110 mNVertex.push_back(0);
111 mNSoftTrig.push_back(0);
112 mPrescales.push_back(0.0);
113 mLumTotal.push_back(0.0);
114 mLumCuts.push_back(0.0);
115 mLumVertex.push_back(0.0);
116 mLumSoftTrig.push_back(0.0);
119 void StLuminosityMaker::setMode(
const char* newMode)
121 float oldxsec = mXsec;
123 if(!strcmp(newMode,
"dAu2008")){
126 }
else if(!strcmp(newMode,
"pp2008")){
129 }
else if(!strcmp(newMode,
"AuAu2007")){
132 }
else if(!strcmp(newMode,
"pp2006")){
135 }
else if(!strcmp(newMode,
"pp2006_62GeV")){
138 }
else if(!strcmp(newMode,
"pp2005")){
141 }
else if(!strcmp(newMode,
"CuCu2005")){
144 }
else if(!strcmp(newMode,
"pp2004")){
147 }
else if(!strcmp(newMode,
"AuAu2004")){
150 }
else if(!strcmp(newMode,
"dAu2003")){
153 }
else if(!strcmp(newMode,
"pp2003")){
156 }
else if(strcmp(newMode,
"")){
157 LOG_ERROR<<
"Invalid mode "<<newMode<<
" passed to StLuminosityMaker"<<endm;
159 LOG_ERROR<<
"StLuminosityMaker requires a running mode"<<endm;
167 void StLuminosityMaker::setCrossSectionNB(
float newXsec,
int overRideMode)
170 mOverrideMode = overRideMode;
174 void StLuminosityMaker::printOutput()
176 LOG_INFO<<
"Luminosity analyzed for Run #"<<runNumber<<
":"<<endm;
177 for(
unsigned int i = 0; i < mTriggers.size(); i++){
178 float totalsampled = 0;
179 float cutsampled = 0;
181 totalsampled = mPrescales[0]*mNTotal[0]/(mPrescales[i]*mXsec);
182 cutsampled = totalsampled * mNCuts[i] / mNTotal[i];
185 LOG_INFO<<
"Trigger "<<mTriggers[i]<<
": "<<totalsampled<<
" nb^-1 total and "<<cutsampled<<
" nb^-1 after cuts, "<<mNTotal[i]<<
" "<<mNCuts[i]<<endm;
189 void StLuminosityMaker::getTriggersFromFilterMaker(
const char* filtername)
193 vector<unsigned int>filtertriggers = filter->getTriggers();
194 for(
unsigned int i = 0; i < filtertriggers.size(); i++){
195 addTrigger(filtertriggers[i]);
199 void StLuminosityMaker::saveOutput()
201 for(
unsigned int i = 0; i < mTriggers.size(); i++){
202 float totalsampled = 0;
203 float vertsampled = 0;
204 float softtrigsampled = 0;
205 float cutsampled = 0;
207 totalsampled = mPrescales[0]*mNTotal[0]/(mPrescales[i]*mXsec);
208 cutsampled = totalsampled * mNCuts[i] / mNTotal[i];
209 softtrigsampled = totalsampled * mNSoftTrig[i] / mNTotal[i];
210 vertsampled = totalsampled * mNVertex[i] / mNTotal[i];
212 mLumTotal[i] = totalsampled;
213 mLumCuts[i] = cutsampled;
214 mLumSoftTrig[i] = softtrigsampled;
215 mLumVertex[i] = vertsampled;
220 lum->setTriggers(mTriggers);
221 lum->setLumTotal(mLumTotal);
222 lum->setLumCuts(mLumCuts);
223 lum->setLumVertex(mLumVertex);
224 lum->setLumSoftTrig(mLumSoftTrig);
225 lum->setNTotal(mNTotal);
226 lum->setNCuts(mNCuts);
227 lum->setNVertex(mNVertex);
228 lum->setNSoftTrig(mNSoftTrig);
229 lum->setPrescales(mPrescales);
230 lum->setCrossSectionNB(mXsec);
231 lum->setVertexCutcm(mVertexCut);
StThreeVectorF primaryVertexPosition(int vtx_id=-1) const
The StMuDst is supposed to be structured in 'physical events'. Therefore there is only 1 primary vert...
Accessor to the database for trigger id information.
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Float_t getTotalPrescaleByTrgId(Int_t trgId)