90 {
92 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
93 MsgStream log(
msgSvc,
"T0MdcCalib");
94 log << MSG::DEBUG << "T0MdcCalib::fillHist()" << endreq;
95
97
98
99 bool esCutFg = event->getEsCutFlag();
100 if( ! esCutFg ) return -1;
101
102 int i;
103 int k;
104 int ntrk;
105 int nhit;
106 int stat;
107
108 int lay;
109 int cel;
110 int wir;
111 int lr;
112 double dmeas;
113 double doca;
114 double resi;
115
117
118 MdcCalRecTrk* rectrk;
119 MdcCalRecHit* rechit;
120
121 ntrk = event -> getNTrk();
122 if((ntrk < m_param.nTrkCut[0]) || (ntrk > m_param.nTrkCut[1])) return -1;
123
124 for(i=0; i<ntrk; i++){
125 rectrk = event -> getRecTrk(i);
126 nhit = rectrk -> getNHits();
127
128
129 double dr = rectrk->
getDr();
130 if(fabs(dr) > m_param.drCut) continue;
131
132
133 double dz = rectrk->
getDz();
134 if(fabs(dz) > m_param.dzCut) continue;
135
136
137 double p = rectrk -> getP();
138 if((fabs(p) < m_param.pCut[0]) || (fabs(p) > m_param.pCut[1])) continue;
139
140 for(lay=0; lay<
MdcCalNLayer; lay++) fgHitLay[lay] =
false;
141 for(k=0; k<nhit; k++){
142 rechit = rectrk -> getRecHit(k);
143 lay = rechit -> getLayid();
144 fgHitLay[lay] = true;
145 }
146
147 int nhitlay = 0;
148 for(lay=0; lay<
MdcCalNLayer; lay++)
if(fgHitLay[lay]) nhitlay++;
149 if(nhitlay < m_param.nHitLayCut) continue;
150
152 if(m_param.noiseCut && (!fgNoise)) continue;
153
154
155 for(k=0; k<nhit; k++){
156 rechit = rectrk -> getRecHit(k);
157 lay = rechit -> getLayid();
158 cel = rechit -> getCellid();
159 wir = m_mdcGeomSvc -> Wire(lay, cel) -> Id();
160 lr = rechit -> getLR();
161 doca = rechit -> getDocaExc();
162 dmeas = rechit -> getDmeas();
163 resi = rechit -> getResiExc();
164 stat = rechit -> getStat();
165
166 if(1 != stat) continue;
167
168 if( (fabs(doca) < m_docaMin[lay]) ||
169 (fabs(doca) > m_docaMax[lay]) ||
170 (fabs(resi) > m_param.resiCut[lay]) ){
171 continue;
172 }
173
174 if(0 == lay){
175 if( ! fgHitLay[1] ) continue;
176 } else if(42 == lay){
177 if( ! fgHitLay[41] ) continue;
178 } else{
179 if( (!fgHitLay[lay-1]) && (!fgHitLay[lay+1]) ) continue;
180 }
181
182 if(wir < (m_mdcGeomSvc->getWireSize()) ){
183 if( 0 == lr ){
184 m_hleft[wir] ->
Fill(resi);
185 }else if( 1 == lr ){
186 m_hright[wir] ->
Fill(resi);
187 }
188 }else{
189 std::cout << "wireid: " << wir << std::endl;
190 }
191 }
192 }
193 return 1;
194}
bool getFgNoiseRatio() const
virtual int fillHist(MdcCalEvent *event)=0