StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuFgtOccTxtMkr.cxx
1 /***************************************************************************
2  *
3  * $Id: StMuFgtOccTxtMkr.cxx,v 1.1 2012/03/06 01:32:35 sgliske Exp $
4  * Author: S. Gliske, March 2012
5  *
6  ***************************************************************************
7  *
8  * Description: See header.
9  *
10  ***************************************************************************
11  *
12  * $Log: StMuFgtOccTxtMkr.cxx,v $
13  * Revision 1.1 2012/03/06 01:32:35 sgliske
14  * creation
15  *
16  *
17  **************************************************************************/
18 
19 #include "StMuFgtOccTxtMkr.h"
20 #include "StRoot/StFgtUtil/StFgtConsts.h"
21 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
22 #include "StRoot/StMuDSTMaker/COMMON/StMuDst.h"
23 #include "StRoot/StMuDSTMaker/COMMON/StMuFgtStrip.h"
24 #include "StRoot/StMuDSTMaker/COMMON/StMuFgtCluster.h"
25 
26 
27 // constructor
28 StMuFgtOccTxtMkr::StMuFgtOccTxtMkr( const Char_t* name ) : StMaker( name ) { /* */ };
29 
30 // deconstructor
31 StMuFgtOccTxtMkr::~StMuFgtOccTxtMkr(){ /* */ };
32 
33 // make
35  Int_t ierr = kStOk;
36 
37  // get pointer to input
38 
39  const StMuDst* muDst = (const StMuDst*)GetInputDS("MuDst");
40  TClonesArray *fgtStrips = 0;
41  TClonesArray *fgtClusters = 0;
42  if( !muDst ){
43  LOG_FATAL << "pointer to StMuDst is null" << endm;
44  ierr = kStFatal;
45  };
46 
47  if( !ierr ){
48  fgtStrips = muDst->fgtArray( muFgtStrips );
49 
50  if( !fgtStrips ){
51  LOG_FATAL << "pointer to muFgtStrips is null" << endm;
52  ierr = kStFatal;
53  };
54  };
55 
56  if( !ierr ){
57  fgtClusters = muDst->fgtArray( muFgtClusters );
58 
59  if( !fgtClusters ){
60  LOG_FATAL << "pointer to muFgtClusters is null" << endm;
61  ierr = kStFatal;
62  };
63  };
64 
65  if( !ierr ){
66  // have pointers to the data, now do some counting
67  Int_t nStrips = fgtStrips->GetEntriesFast();
68  Int_t nClusters = fgtClusters->GetEntriesFast();
69  Int_t nRclus[kFgtNumOctantsPerDisc*kFgtNumDiscs], nPhiClus[kFgtNumOctantsPerDisc*kFgtNumDiscs];
70 
71  // zero counts
72  for( Int_t i = 0; i < kFgtNumOctantsPerDisc*kFgtNumDiscs; ++i )
73  nRclus[i] = nPhiClus[i] = 0;
74 
75  for( Int_t i = 0; i < nClusters; ++i ){
76  StMuFgtCluster* clus = static_cast< StMuFgtCluster* >( (*fgtClusters)[i] );
77  if( clus ){
78  // determine which octant this is in
79  Int_t geoId = clus->getCentralStripGeoId();
80 
81  Short_t disc, quad, strip;
82  Char_t layer;
83  StFgtGeom::decodeGeoId( geoId, disc, quad, layer, strip );
84 
85  Int_t idx = (quad*2 + ( StFgtGeom::getOctant( layer, strip ) == 'S' ))*kFgtNumDiscs + disc;
86  assert( idx < kFgtNumOctantsPerDisc*kFgtNumDiscs ); // ensure decoding is working
87 
88  if( layer == 'R' )
89  ++nRclus[idx];
90  else
91  ++nPhiClus[idx];
92  };
93  };
94 
95  cout << "--------------------------------------------------------------" << endl;
96  cout << "Event #" << GetEventNumber() << ", number of strips " << nStrips << endl << endl;
97 
98  if( nStrips > 0 ){
99  cout << "disc # | layer";
100  for( Char_t quad = 'A'; quad <= 'D'; ++quad )
101  cout << " | " << quad << ".L | " << quad << ".S";
102  cout << endl;
103 
104  for( Int_t disc = 0; disc < kFgtNumDiscs; ++disc ){
105  for( Int_t layerIsR = 0; layerIsR < 2; ++layerIsR ){
106  cout << " " << disc+1 << " | " << (layerIsR ? 'R' : 'P') << " ";
107  for( Int_t quad = 0; quad < kFgtNumQuads; ++quad ){
108  for( Int_t oct = 0; oct < 2; ++oct ){
109 
110  Int_t idx = (quad*2 + oct)*kFgtNumDiscs + disc;
111  cout << " | " << Form("%3d", ( layerIsR ? nRclus[idx] : nPhiClus[idx] ) );
112  };
113  };
114  cout << endl;
115  };
116  };
117  };
118  };
119 
120  return ierr;
121 };
122 
123 ClassImp(StMuFgtOccTxtMkr);
virtual Int_t Make()
static TClonesArray * fgtArray(int type)
returns pointer to the n-th TClonesArray from the fgt arrays
Definition: StMuDst.h:293
Definition: Stypes.h:41