StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StBbcVertexMaker.cxx
1 // *-- Author : Jan Balewski
2 //
3 // $Id: StBbcVertexMaker.cxx,v 1.3 2011/04/11 19:35:40 fisyak Exp $
4 
5 #include <TFile.h>
6 
7 #include "StBbcVertexMaker.h"
8 
9 #include "TChain.h"
10 #include "TClonesArray.h"
11 #include "StL0Trigger.h"
12 #include "StEventInfo.h"
13 #include "StEventSummary.h"
14 #include "StarClassLibrary/StThreeVectorF.hh"
15 #include "StMuDSTMaker/COMMON/StMuEvent.h"
16 #include "StMuDSTMaker/COMMON/StMuTrack.h"
17 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
18 #include "StMuDSTMaker/COMMON/StMuTriggerIdCollection.h"
19 #include "StEvent/StTriggerId.h"
20 
21 #include <StMessMgr.h>
22 #include "BbcHex.h"
23 
24 ClassImp(StBbcVertexMaker)
25 
26 //________________________________________________
27 //________________________________________________
28 StBbcVertexMaker::StBbcVertexMaker(const char* self ,const char* muDstMakerName) : StMaker(self){
29  mMuDstMaker = (StMuDstMaker*)GetMaker(muDstMakerName);
30  assert(mMuDstMaker);
31 
32 }
33 
34 
35 //___________________ _____________________________
36 //________________________________________________
37 StBbcVertexMaker::~StBbcVertexMaker(){
38  // Save all objects in this file
39  // hfile->Write();
40 }
41 
42 //________________________________________________
43 //________________________________________________
44 Int_t StBbcVertexMaker::InitRun(int runNo){
45  initRun(runNo);
46  return kStOK;
47 }
48 
49 //________________________________________________
50 //________________________________________________
51 Int_t StBbcVertexMaker::Init(){
52  BbcVertex::init();
53  // gMessMgr->Info() << GetName() << "has MCflag="<< MCflag<<endm;
54  return StMaker::Init();
55 }
56 
57 //________________________________________________
58 //________________________________________________
60  finish();
61  return kStOK;
62 }
63 
64 
65 
66 
67 //________________________________________________
68 //________________________________________________
70  clear();
71 
72  if( !unpackMuTrig()) return kStOK;
73 
74  doVertex();
75 
76  return kStOK;
77 }
78 
79 
80 
81 
82 //________________________________________________
83 //________________________________________________
84 bool StBbcVertexMaker::unpackMuTrig(){
85 
86  // printf("%s::unpackMuTrig() is called ..........\n",StMaker::GetName());
87 
88  // Access to muDst .......................
89  StMuEvent* muEve = mMuDstMaker->muDst()->event();
90  // int nPrim = mMuDstMaker->muDst()->primaryTracks()->GetEntries(); // get number of primary tracks
91 
92  StEventInfo &info=muEve->eventInfo();
93  unixTime=info.time();
94  if(unixTime0==0) unixTime0=unixTime;
95 
96  StMuTriggerIdCollection& trgIdColl=muEve->triggerIdCollection();
97 
98  StEventSummary &smry=muEve->eventSummary();
99  StThreeVectorF ver=smry.primaryVertexPosition();
100 
101  zTpc=ver.z();
102  if( fabs(ver.x())<0.000001 &&fabs(ver.y())<0.000001 &&fabs(ver.z())<0.000001 ) {
103  zTpc=999;
104  return false;
105  }
106 
107  const StTriggerId& oflTrgId=trgIdColl.nominal();
108  vector<unsigned int> trgId=oflTrgId.triggerIds();
109 
110  // printf("\n\n ==================== processing eventID %d nPrim=%d nTrig=%d==============\n", info.id(),nPrim, trgId.size());
111 
112  bool isGood=false;
113  UInt_t i;
114  for(i = 0; i < trgId.size() ; i++){
115  // printf("i=%d trgId=%d\n",i,trgId[i]);
116  //.......... minB trig in pp200 in 2004
117  if(trgId[i]==10) isGood=true; // minb-slow
118  if(trgId[i]==45010) isGood=true; // minb-slow
119  // if(trgId[i]==45020) isGood=true; // minb-fast
120  // if(trgId[i]==45203) isGood=true; // eth-1-slow
121  }
122  if(!isGood) return false;
123 
124  StBbcTriggerDetector & bbc=muEve->bbcTriggerDetector ();
125  for(i=0;i<mxHex;i++) {
126  hex[0][i]->setHit(bbc.tdc(i),bbc.adc(i));
127  hex[1][i]->setHit(bbc.tdc(i+24),bbc.adc(i+24));
128  // hex[0][i]->print(); hex[1][i]->print();
129  }
130  onlTdiff=bbc.onlineTimeDifference ();
131  return isGood;
132 }
133 
134 
135 
136 
137 // $Log: StBbcVertexMaker.cxx,v $
138 // Revision 1.3 2011/04/11 19:35:40 fisyak
139 // Replace uint by UInt_t, use TMath
140 //
141 // Revision 1.2 2004/12/04 05:07:38 balewski
142 // export to NN
143 //
144 // Revision 1.1 2004/08/31 03:44:13 balewski
145 // first
146 //
147 // Revision 1.7 2004/08/26 04:39:40 balewski
StMuDst * muDst()
Definition: StMuDstMaker.h:425
virtual Int_t Make()
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
Definition: Stypes.h:40
Axample to access muDst and pass it to ezTree analyzis class.
virtual Int_t Finish()
Collection of trigger ids as stored in MuDst.