StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StRandyTopMapMaker.cxx
1 /***************************************************************************
2  *
3  * $Id: StRandyTopMapMaker.cxx,v 1.6 2007/04/28 17:56:15 perev Exp $
4  *
5  * Author: Torre Wenaus, BNL,
6  * Thomas Ullrich, Nov 1999
7  ***************************************************************************
8  *
9  * Description: This is an example of a maker to perform analysis
10  * using StEvent.
11  * Use this as a template and customize it for your
12  * studies.
13  *
14  ***************************************************************************
15  *
16  * $Log: StRandyTopMapMaker.cxx,v $
17  * Revision 1.6 2007/04/28 17:56:15 perev
18  * Redundant StChain.h removed
19  *
20  * Revision 1.5 2000/05/02 22:13:24 laue
21  * Memory leak fixed
22  *
23  * Revision 1.4 2000/04/03 23:18:36 rcwells
24  * Improved speed in RandyTopMapMaker
25  *
26  * Revision 1.3 2000/04/03 20:28:10 rcwells
27  * Removed remnant Pt tag in code from StAnalysisMaker.
28  *
29  * Revision 1.2 2000/04/02 20:41:17 rcwells
30  * Fixed the FTPC bit check.
31  *
32  * Revision 2.1 1999/12/30 01:54:57 ogilvie
33  * added countPrimaryPions as example how to use PID
34  *
35  * Revision 2.0 1999/11/04 16:10:03 ullrich
36  * Revision for new StEvent
37  *
38  **************************************************************************/
39 #include "StRandyTopMapMaker.h"
40 #include "StEventTypes.h"
41 #include "StMessMgr.h"
42 #include "StEvent.h"
43 #include "StTrackGeometry.h"
44 #include "StTrackTopologyMap.h"
45 
46 static const char rcsid[] = "$Id: StRandyTopMapMaker.cxx,v 1.6 2007/04/28 17:56:15 perev Exp $";
47 
48 ClassImp(StRandyTopMapMaker)
49 
50 StRandyTopMapMaker::StRandyTopMapMaker(const Char_t *name) : StMaker(name)
51 {
52 // drawinit = kFALSE;
53 }
54 
55 StRandyTopMapMaker::~StRandyTopMapMaker() {
56 }
57 
58 Int_t
59 StRandyTopMapMaker::Init()
60 {
61  return StMaker::Init();
62 }
63 
64 void
66 {
68 }
69 
70 Int_t
72 {
73  return kStOK;
74 }
75 
76 Int_t
78 {
79  //
80  // This method is called every event. That's the
81  // right place to plug in your analysis to be
82  // done every event.
83  //
84  StEvent* mEvent;
85  mEvent = (StEvent *) GetInputDS("StEvent");
86  if (! mEvent) return kStOK; // If no event, we're done
87 
88  // OK, we've got the event. Let's fix that Topology Map
89  // This only fixes TPC pad rows and the turnaround flag
90  StTrack* rTrack;
91  int mult = mEvent->trackNodes().size();
92  unsigned long mask2 = 0x80000000;
93  unsigned long temp1;
94  int pad, ipad;
95  bool padRow[46];
96  unsigned long map1, map2;
97  StPtrVecHit myHitVector;
98  StPtrVecHitIterator myHitIterator;
99  StTpcHit* myHit;
100  // For speed we try to remove the turnAround flag
101  // bool turnAround;
102  for (unsigned long int icount=0; icount<(unsigned long int)mult; icount++){
103  rTrack = mEvent->trackNodes()[icount]->track(global);
104  // Changed code
105  // This checks bits that should not be set
106  temp1 = rTrack->topologyMap().data(1) & mask2;
107  // If FTPC track, don't do anything
108  if ( int(temp1) ) continue;
109  // numHits = rTrack->detectorInfo()->hits(kTpcId).size();
110  // turnAround = false;
111  // Zero pad rows
112  for (ipad=0; ipad<46; ipad++) padRow[ipad] = false;
113  myHitVector = rTrack->detectorInfo()->hits(kTpcId);
114  for (myHitIterator=myHitVector.begin(); myHitIterator!=myHitVector.end(); myHitIterator++) {
115  myHit = (StTpcHit *)(*myHitIterator);
116  pad = myHit->padrow();
117  padRow[pad] = true;
118  }
119  /*
120  for (ihit=0; ihit<numHits; ihit++) {
121  myHit = (StTpcHit *)(rTrack->detectorInfo()->hits(kTpcId)[ihit]);
122  pad = myHit->padrow();
123  // if ( padRow[pad] ) turnAround = true;
124  padRow[pad] = true;
125  }
126  */
127  map1 = map2 = 0;
128  // Fill the map
129  for (ipad=1; ipad<=24; ipad++) {
130  if ( padRow[ipad] ) {
131  map1 |= 1UL<<(ipad+7);
132  }
133  }
134  for (ipad=25; ipad<=45; ipad++) {
135  if ( padRow[ipad] ) {
136  map2 |= 1UL<<(ipad-25);
137  }
138  }
139  // if ( turnAround ) map2 |= 1UL<<(30);
140  StTrackTopologyMap aNewMap( map1,map2 );
141  rTrack->setTopologyMap( aNewMap );
142  }
143 
144  myHitVector.clear();
145  return kStOK;
146 }
virtual void Clear(Option_t *option="")
User defined functions.
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StMaker.cxx:634
virtual Int_t Finish()
Definition: Stypes.h:40