00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00042 #include "StPeCLumiMaker.h"
00043 #include "StEventTypes.h"
00044 #include "Stypes.h"
00045 #include "StMessMgr.h"
00046 #include "TH1.h"
00047 #include <vector>
00048 #ifndef ST_NO_NAMESPACES
00049 using std::vector;
00050 #endif
00051
00052 #include "StTriggerDetectorCollection.h"
00053 #include "StCtbTriggerDetector.h"
00054 #include "StMwcTriggerDetector.h"
00055 #include "StVpdTriggerDetector.h"
00056 #include "StZdcTriggerDetector.h"
00057 #include "StFtpcHitCollection.h"
00058 #include "StFtpcPlaneHitCollection.h"
00059 #include "StFtpcSectorHitCollection.h"
00060
00061 #include "StMcEventTypes.hh"
00062 #include "StMcEventMaker/StMcEventMaker.h"
00063 #include "StIOMaker/StIOMaker.h"
00064
00065
00066
00067 static const char rcsid[] = "$Id: StPeCLumiMaker.cxx,v 1.7 2007/04/28 17:56:33 perev Exp $";
00068
00069 ClassImp(StPeCLumiMaker)
00070
00071 StPeCLumiMaker::StPeCLumiMaker(const Char_t *name) : StMaker(name) {
00072
00073
00074 }
00075
00076 StPeCLumiMaker::~StPeCLumiMaker() {}
00077
00078 Int_t StPeCLumiMaker::Init() {
00079 cout << "StPeCLumiMaker::Init, Do nothing!";
00080 return StMaker::Init();
00081 }
00082
00083 Int_t StPeCLumiMaker::InitRun(Int_t runnr) {
00084
00085
00086 cout<<"StPeCLumiMaker: Initializing..run " << runnr <<endl;
00087
00088
00089
00090 TString uDstFileName("StPeCMaker.tree.root");
00091 StIOMaker* pIOMaker = (StIOMaker*)GetMaker("IO");
00092 if ( pIOMaker) {
00093 uDstFileName = pIOMaker->GetFile() ;
00094 char* ccc = "/" ;
00095 Ssiz_t slashPosition = uDstFileName.Last(*ccc) ;
00096 if ( slashPosition != -1 &&
00097 slashPosition < uDstFileName.Length() )
00098 uDstFileName.Remove(0,slashPosition+1);
00099 }
00100
00101 cout << uDstFileName << endl;
00102 TString tDst("dst");
00103 TString tEvt("event");
00104 TString tEvtSel("evtsel");
00105 TString tuDst("lumiDst");
00106 TString tuDstSel("lumiDstSel");
00107 uDstFileName.ReplaceAll(tDst,tuDst);
00108 uDstFileName.ReplaceAll(tEvt,tuDst);
00109 uDstFileName.ReplaceAll(tEvtSel,tuDstSel);
00110 cout << "StPeCLumiMaker: uDst output file: " << uDstFileName << endl;
00111
00112
00113
00114 m_outfile = new TFile( uDstFileName,"recreate");
00115
00116
00117
00118
00119
00120
00121 uDstTree = new TTree("uDst","Pcol uDst",99);
00122
00123
00124 LumiEntry = new StPeCLumiEntry() ;
00125 uDstTree->Branch ("LumiEntry","StPeCLumiEntry",&LumiEntry,64000,1);
00126
00127
00128 cout<<"StPeCLumiMaker: Initialization done!"<<endl;
00129
00130 return StMaker::InitRun(runnr);
00131 }
00132
00133
00134 Int_t StPeCLumiMaker::Make() {
00135
00136
00137
00138
00139
00140
00141 if (muDst) {
00142 cout<<"StPeCLumiMaker: Reading muDst"<<endl;
00143 Int_t NTracks = muDst->globalTracks()->GetEntries();
00144 cout<<"StPeCLumiMaker: Number of tracks "<<NTracks<<endl;
00145
00146 Int_t flag = kStOk ;
00147
00148 if( NTracks > StPeCnMaxTracks ){
00149 cout<<"StPeCLumiMaker: Number of tracks: "<<NTracks<<endl;
00150 cout<<"Not a peripheral event (NTracks>15)"<<endl;
00151 flag = kStErr;
00152 }
00153 if( NTracks <= 1 ){
00154 cout<<"StPeCLumiMaker: Event has no tracks!"<<endl;
00155 flag = kStErr;
00156 }
00157
00158
00159 StL0Trigger &trig = muDst->event()->l0Trigger();
00160 int tw = trig.triggerWord();
00161 cout << "Trigger word " << tw << endl;
00162 if (tw == 0x3001 || tw==0x3002 || tw == 0x3011 || tw == 0x1001 ) {
00163 cout << "UPC trigger filter event" << endl;
00164 flag= kStOk;
00165 }
00166
00167
00168 LumiEntry->fill(muDst );
00169
00170 uDstTree->Fill();
00171
00172 return flag ;
00173
00174 }
00175
00176
00177 else {
00178
00179 StEvent* event = 0 ;
00180 event = (StEvent *) GetInputDS("StEvent");
00181
00182 if (event){
00183
00184
00185 StSPtrVecTrackNode& tempn = event->trackNodes();
00186 Int_t NTracks=tempn.size();
00187 cout<<"StPeCLumiMaker: Number of tracks: "<<NTracks<<endl;
00188
00189 Int_t flag = kStOk ;
00190
00191 if( NTracks > StPeCnMaxTracks ){
00192 cout<<"StPeCLumiMaker: Number of tracks: "<<NTracks<<endl;
00193 cout<<"Not a peripheral event (NTracks>15)"<<endl;
00194 flag = kStErr;
00195 }
00196 if( NTracks <= 1 ){
00197 cout<<"StPeCLumiMaker: Event has no tracks!"<<endl;
00198 flag = kStErr;
00199 }
00200
00201 int tw = event->l0Trigger()->triggerWord();
00202 cout << "Trigger word " << tw << endl;
00203 if (tw == 0x3001 || tw==0x3002 || tw == 0x3011 || tw == 0x1001 ) {
00204 cout << "UPC trigger filter event" << endl;
00205 flag= kStOk;
00206 }
00207
00208
00209
00210 LumiEntry->fill( event );
00211
00212 uDstTree->Fill();
00213
00214 return flag ;
00215 }
00216 else {
00217 cout<<"StPeCLumiMaker: There was no StEvent! Return."<<endl;
00218 return kStOK;
00219 }
00220 }
00221 }
00222
00223 Int_t StPeCLumiMaker::Finish() {
00224 cout << "StPeCLumiMaker: Finish" << endl;
00225 m_outfile->Write();
00226 m_outfile->Close();
00227 StMaker::Finish();
00228 return kStOK;
00229 }
00230
00231