StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StRareEvent.cxx
1 #include "StRareEvent.h"
2 #include "StRareTrack.h"
3 #include "StL3RareTrack.h"
4 #include "StEventTypes.h"
5 #include "StThreeVectorF.hh"
6 #include "StEventUtilities/StuRefMult.hh"
7 
8 ClassImp(StRareEvent)
9 
10 TClonesArray* StRareEvent::fgRareTracks = 0;
11 TClonesArray* StRareEvent::fgL3RareTracks = 0;
12 
14  if (!fgRareTracks) fgRareTracks = new TClonesArray("StRareTrack",4000);
15  fRareTracks = fgRareTracks;
16  fNRareTrack = 0;
17  if (!fgL3RareTracks) fgL3RareTracks = new TClonesArray("StL3RareTrack",4000);
18  fL3RareTracks = fgL3RareTracks;
19  fNL3RareTrack = 0;
20 }
21 
22 
23 StRareEvent::~StRareEvent() {
24  fgRareTracks->Delete();
25  fgL3RareTracks->Delete();
26 }
27 
28 
29 void StRareEvent::fillRareEvent(StEvent* event){
30  fRunNumber = event->runId();
31  fEventNumber = event->id();
32  fmagneticField = event->summary()->magneticField();
33  // fmagneticField = 0.25;
34  // fnumberOfGoodPrimaryTracks = event->summary()->numberOfGoodPrimaryTracks();
35  StEvent& evt = *event;
36  fnumberOfGoodPrimaryTracks = uncorrectedNumberOfNegativePrimaries(evt);
37  if (event->primaryVertex()) {
38  fVertexZ = event->primaryVertex()->position().z();
39  }
40  else {
41  fVertexZ = -999.0;
42  }
43 
44  StL0Trigger* myL0Trigger = event->l0Trigger();
45  if (!myL0Trigger) {
46  fTriggerWord = 0;
47  }
48  else fTriggerWord = myL0Trigger->triggerWord();
49 }
50 
51 
52 void StRareEvent::fillL3Info(StL3Trigger *l3trigger)
53 {
54  if (l3trigger->primaryVertex()) {
55  fL3VertexZ = l3trigger->primaryVertex()->position().z();
56  }
57  else fL3VertexZ = -999;
58 
59  // get event summary
60  const StL3EventSummary* l3EventSummary = l3trigger->l3EventSummary();
61  if (!l3EventSummary) {
62  cout << "No l3 event summary found." << endl;
63  return;
64  }
65 
66  fL3Unbiased = l3EventSummary->unbiasedTrigger();
67 
68  fL3Flag = kFALSE;
69 
70  // fill counters for anti-nucleus trigger
71  const StPtrVecL3AlgorithmInfo& algInfo = l3EventSummary->algorithmsAcceptingEvent();
72  for (unsigned int i=0; i<algInfo.size(); i++) {
73  if (algInfo[i]->id() == 6) {
74  fL3Flag = kTRUE;
75  fNProcessed = algInfo[i]->numberOfProcessedEvents();
76  fNAccept = algInfo[i]->numberOfAcceptedEvents();
77  fNBuild = algInfo[i]->numberOfBuildEvents();
78  for (int j=0; j<algInfo[i]->dataSize(); j++)
79  fTriggerData[j] = algInfo[i]->data(j);
80  }
81  }
82 
83 }
84 
85 
86 void StRareEvent::clear(Option_t *option) {
87  fgRareTracks->Clear(option);
88  fNRareTrack = 0;
89  fgL3RareTracks->Clear(option);
90  fNL3RareTrack = 0;
91 }
92 
93 
94 void StRareEvent::addTrack(StPrimaryTrack* track) {
95  TClonesArray &trks = *fRareTracks;
96  new (trks[fNRareTrack++]) StRareTrack(track);
97 }
98 
99 
100 void StRareEvent::addL3Track(StGlobalTrack* l3track) {
101  TClonesArray &l3trks = *fgL3RareTracks;
102 // // temporary fix for dip angle:
103 // StPhysicalHelixD oldhelix = l3track->geometry()->helix();
104 // StHelixD l3helix(0.001*oldhelix.curvature(), atan(oldhelix.dipAngle()),
105 // // oldhelix.phase()+TMath::Pi(), oldhelix.origin(), -1*oldhelix.h());
106 // oldhelix.phase(), oldhelix.origin(), oldhelix.h());
107 // StThreeVectorD vertex(0, 0, zVertex);
108 // double dca2d = l3helix.distance(vertex);
109 // // fix end
110 // //cout << zVertex << " ==> dca 2d : " << dca2d << endl;
111  new (l3trks[fNL3RareTrack++]) StL3RareTrack(l3track);
112 }
113