001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024 #ifndef STORABLEBANKS_VTVZ_STORABLEBANK_HH
025 #include "StorableBanks/VTVZ_StorableBank.hh"
026 #endif
027
028 #include "Trybos/TRY_Bank_Name.hh"
029 #include "Trybos/TRY_Bank_Number.hh"
030 #include "Trybos/TRY_Bank_Type.hh"
031
032 #include <iostream>
033 #include <iomanip>
034
035 #if defined (__GNUG__) && (__GNUC_MAJOR__ == 2) && (__GNUC_MINOR__ <= 95)
036 # define istringstream istrstream
037 # define ostringstream ostrstream
038 # include <strstream>
039 #else
040 # include <sstream>
041 #endif
042
043
044
045
046
047
048
049
050 const uint4 VTVZ_StorableBank_format::n_ztrack_mask = 0xffff ;
051 const uint4 VTVZ_StorableBank_format::n_ztrack_shift = 0 ;
052 const uint4 VTVZ_StorableBank_format::n_forward_mask = 0xffff0000 ;
053 const uint4 VTVZ_StorableBank_format::n_forward_shift = 16 ;
054
055 const uint4 VTVZ_StorableBank_format::n_hit_mask = 0xfff ;
056 const uint4 VTVZ_StorableBank_format::n_hit_shift = 0 ;
057 const uint4 VTVZ_StorableBank_format::n_segment_mask = 0x3ff000 ;
058 const uint4 VTVZ_StorableBank_format::n_segment_shift = 12 ;
059 const uint4 VTVZ_StorableBank_format::position_at_z0_mask = 0xffff ;
060 const uint4 VTVZ_StorableBank_format::position_at_z0_shift = 0 ;
061 const uint4 VTVZ_StorableBank_format::deriv_wrt_z_mask = 0xffff0000 ;
062 const uint4 VTVZ_StorableBank_format::deriv_wrt_z_shift = 16 ;
063
064 VTVZ_StorableBank_format::BeamDecodeUnion VTVZ_StorableBank_format::bmDecode = { 0 } ;
065
066
067
068
069 VTVZ_StorableBank::
070 VTVZ_StorableBank(void):
071 StorableBank(form_bank_name(), 0, form_bank_type())
072 { }
073
074 VTVZ_StorableBank::
075 VTVZ_StorableBank(const VTVZ_StorableBank& bank):
076 StorableBank(bank)
077 { }
078
079 VTVZ_StorableBank&
080 VTVZ_StorableBank::
081 operator = (const VTVZ_StorableBank& bank)
082 { if (this != &bank)
083 { StorableBank::assign(bank) ;
084 }
085 return(*this) ;
086 }
087
088 VTVZ_StorableBank::
089 VTVZ_StorableBank(const TRY_Bank_Number& bank_number,
090 const int nVertices):
091 StorableBank(form_bank_name(), bank_number, form_bank_type(nVertices))
092 { }
093
094 VTVZ_StorableBank::
095 VTVZ_StorableBank(const TRY_Generic_Bank& my_bank):
096 StorableBank(my_bank)
097 {
098 }
099
100
101
102
103 VTVZ_StorableBank::
104 ~VTVZ_StorableBank(void)
105 { }
106
107
108
109
110 std::string
111 VTVZ_StorableBank::
112 class_name(void) const
113 { return(VTVZ_StorableBank::Class_Name()) ;
114 }
115
116 Version_t
117 VTVZ_StorableBank::
118 class_version(void) const
119 { return(VTVZ_StorableBank::Class_Version()) ;
120 }
121
122 TRY_Bank_Name
123 VTVZ_StorableBank::
124 form_bank_name(void)
125 { return( TRY_Bank_Name("VTVZ") ) ;
126 }
127
128 TRY_Bank_Type
129 VTVZ_StorableBank::
130 form_bank_type(int nVertex)
131 { std::string typeString("(");
132 typeString += VTVZ_StorableBank_format::headerTypeString() ;
133 typeString += ',' ;
134
135 std::ostringstream temp;
136 temp << nVertex ;
137 typeString += temp.str() ;
138
139 typeString += '(' ;
140 typeString += VTVZ_StorableBank_format::vertexTypeString() ;
141 typeString += "))" ;
142 return TRY_Bank_Type( typeString ) ;
143 }
144
145
146
147
148 void
149 VTVZ_StorableBank::
150 print(std::ostream& output) const
151 {
152 output << std::endl;
153 if ( run1_bank() )
154 {
155 output << "Run1 VTVZ bank" ;
156 }
157 else
158 {
159 output << "Run2 VTVZ bank" ;
160 }
161 output << " Data length = " << n_data_words()
162 << " Vertex block length = " << n_words_per_vertex() << std::endl;
163
164 output << "N vertices = " << n_vertex()
165 << ", N primaries = " << n_prim_vertex() << std::endl;
166 output << "Bank status = " << bank_status_word() << std::endl;
167 int n;
168 Vertex_Iter i;
169 for ( i.assign( *this ), n = 0 ; i.isValid() ; ++i, ++n )
170 {
171 output << " Vert " << n
172 << " Class = " << vertex_class( i )
173 << " Z = " << z( i )
174 << " Zrms = " << z_rms( i ) ;
175 if ( run2_bank() )
176 {
177 output << " Nforw = " << nForward( i )
178 << " Nback = " << nZtracks( i ) - nForward( i ) ;
179
180 }
181 else
182 {
183 output << " Nhit = " << nHit( i )
184 << " NSeg = " << nSegment( i )
185 << " t0 = " << t0( i ) ;
186 }
187 output << std::endl ;
188 }
189 if ( run1_bank() &&
190 (bank_status_word() >= VTVZ_StorableBank_format::CTC_beam_position) )
191 {
192 output << "Beam x0 = " << beam_x0()
193 << " dxdz = " << beam_dxdz() << std::endl
194 << "Beam y0 = " << beam_y0()
195 << " dydz = " << beam_dydz() << std::endl;
196 }
197 }
198
199
200
201
202 bool
203 VTVZ_StorableBank::
204 set_n_vertex( int4 nvertex )
205 { TRY_Bank_Type bankType = form_bank_type(nvertex) ;
206 StorableBank::set_bank_type(bankType) ;
207
208 int ndata = VTVZ_StorableBank_format::n_header_words +
209 nvertex * VTVZ_StorableBank_format::run2_vertex_block_length ;
210 return set_I4_element( 0, VTVZ_StorableBank_format::n_data_words_index, ndata ) ;
211 }
212
213
214
215
216
217
218
Send problems or questions to cdfcode@fnal.gov