87 {
89 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc );
90 MsgStream log(
msgSvc,
"ResiAlign" );
91 log << MSG::INFO << "ResiAlign::initialize()" << endmsg;
92
93 m_hlist = hlist;
94 m_mdcGeomSvc = mdcGeomSvc;
95 m_mdcFunSvc = mdcFunSvc;
96 m_mdcUtilitySvc = mdcUtilitySvc;
97
98 double zeast;
99 for ( int lay = 0; lay < 43; lay++ )
100 {
101 zeast = m_mdcGeomSvc->Wire( lay, 0 )->Backward().z();
102 m_zrange[lay][1] = 2.0 * fabs( zeast ) / (double)m_ndiv;
103 m_zrange[lay][0] = -1.0 * m_zrange[lay][1];
104
105 m_radii[lay] = m_mdcGeomSvc->Layer( lay )->Radius();
106 }
107
108 for (
int wir = 0; wir <
WIRENMAX; wir++ )
109 {
110 m_xe[wir] = m_mdcGeomSvc->Wire( wir )->Backward().x();
111 m_ye[wir] = m_mdcGeomSvc->Wire( wir )->Backward().y();
112 m_ze[wir] = m_mdcGeomSvc->Wire( wir )->Backward().z();
113 m_xw[wir] = m_mdcGeomSvc->Wire( wir )->Forward().x();
114 m_yw[wir] = m_mdcGeomSvc->Wire( wir )->Forward().y();
115 m_zw[wir] = m_mdcGeomSvc->Wire( wir )->Forward().z();
116 }
117
118 char hname[200];
119 int iEP;
120
121 INTupleSvc* ntupleSvc;
122 Gaudi::svcLocator()->service( "NTupleSvc", ntupleSvc );
123 for ( iEP = 0; iEP <=
NEP; iEP++ )
124 {
125 if ( iEP <
NEP )
sprintf( hname,
"FILE137/align%02d", iEP );
126 else sprintf( hname,
"FILE137/alignAll" );
127
128 NTuplePtr nt( ntupleSvc, hname );
129 if ( nt ) m_tuple[iEP] = nt;
130 else
131 {
132 m_tuple[iEP] = ntupleSvc->book( hname, CLID_ColumnWiseTuple, "align" );
133 if ( m_tuple[iEP] )
134 {
135 m_tuple[iEP]->addItem( "run", m_iRun[iEP] );
136 m_tuple[iEP]->addItem( "evt", m_iEvt[iEP] );
137 m_tuple[iEP]->addItem( "resi", m_resi[iEP] );
138 m_tuple[iEP]->addItem( "p", m_p[iEP] );
139 m_tuple[iEP]->addItem( "pt", m_pt[iEP] );
140 m_tuple[iEP]->addItem( "phi", m_phi[iEP] );
141 m_tuple[iEP]->addItem( "lay", m_lay[iEP] );
142 m_tuple[iEP]->addItem( "lr", m_lr[iEP] );
143 m_tuple[iEP]->addItem( "cel", m_cel[iEP] );
144 }
145 else { log << MSG::FATAL << "Cannot book N-tuple:" << long( m_tuple[iEP] ) << endmsg; }
146 }
147 }
148
149 m_hnTrk = new TH1F( "HNtrack", "", 10, -0.5, 9.5 );
150 m_hlist->Add( m_hnTrk );
151
152 m_hnHit = new TH1F( "HNhit", "", 100, -0.5, 99.5 );
153 m_hlist->Add( m_hnHit );
154
155 m_hlayHitmap = new TH1F( "Hitmap", "", 43, -0.5, 42.5 );
156 m_hlist->Add( m_hlayHitmap );
157
158 m_hresAll = new TH1F( "HResAllInc", "", 200, -1.0, 1.0 );
159 m_hlist->Add( m_hresAll );
160
161 m_hresInn = new TH1F( "HResInnInc", "", 200, -1.0, 1.0 );
162 m_hlist->Add( m_hresInn );
163
164 m_hresStp = new TH1F( "HResStpInc", "", 200, -1.0, 1.0 );
165 m_hlist->Add( m_hresStp );
166
167 m_hresOut = new TH1F( "HResOutInc", "", 200, -1.0, 1.0 );
168 m_hlist->Add( m_hresOut );
169
170 int lay;
172 {
173 sprintf( hname,
"Res_Layer%02d", lay );
174 m_hresLay[lay] = new TH1F( hname, "", 200, -1.0, 1.0 );
175 m_hlist->Add( m_hresLay[lay] );
176
177 for ( int i = 0; i < 4; i++ )
178 {
179 if ( 0 == i )
sprintf( hname,
"Resi_Lay%02d_Up_L", lay );
180 else if ( 1 == i )
sprintf( hname,
"Resi_Lay%02d_Up_R", lay );
181 else if ( 2 == i )
sprintf( hname,
"Resi_Lay%02d_Dw_L", lay );
182 else sprintf( hname,
"Resi_Lay%02d_Dw_R", lay );
183 m_hresLay_LR[lay][i] = new TH1F( hname, "", 200, -1.0, 1.0 );
184 m_hlist->Add( m_hresLay_LR[lay][i] );
185 }
186 }
187
188 for ( iEP = 0; iEP <
NEP; iEP++ )
189 {
190 m_gr[iEP] = new TGraph();
191 sprintf( hname,
"grResi%02d", iEP );
192 m_gr[iEP]->SetName( hname );
193 m_hlist->Add( m_gr[iEP] );
194 }
195 m_fevt.open( "evt.txt" );
196}