32 std::map<int, unsigned int> Lc_modeTag, Ds_modeTag, D0_modeTag, Dp_modeTag;
44 Lc_modeTag[1034] = 10;
45 Lc_modeTag[1060] = 11;
46 Lc_modeTag[1061] = 12;
47 Lc_modeTag[1062] = 13;
48 Lc_modeTag[1063] = 14;
49 Lc_modeTag[1064] = 15;
50 Lc_modeTag[1065] = 16;
100 D0_modeTag[103] = 15;
101 D0_modeTag[104] = 16;
102 D0_modeTag[105] = 16;
103 D0_modeTag[106] = 17;
104 D0_modeTag[107] = 16;
105 D0_modeTag[108] = 16;
106 D0_modeTag[109] = 18;
107 D0_modeTag[110] = 19;
108 D0_modeTag[111] = 20;
109 D0_modeTag[112] = 16;
110 D0_modeTag[113] = 21;
111 D0_modeTag[114] = 22;
112 D0_modeTag[115] = 23;
113 D0_modeTag[116] = 24;
114 D0_modeTag[117] = 25;
115 D0_modeTag[118] = 26;
116 D0_modeTag[119] = 27;
117 D0_modeTag[120] = 28;
118 D0_modeTag[121] = 29;
119 D0_modeTag[122] = 30;
120 D0_modeTag[123] = 30;
121 D0_modeTag[124] = 30;
122 D0_modeTag[125] = 30;
123 D0_modeTag[126] = 30;
124 D0_modeTag[127] = 30;
125 D0_modeTag[128] = 30;
126 D0_modeTag[129] = 30;
127 D0_modeTag[130] = 30;
128 D0_modeTag[131] = 30;
129 D0_modeTag[132] = 30;
130 D0_modeTag[133] = 30;
131 D0_modeTag[134] = 30;
132 D0_modeTag[135] = 30;
144 Dp_modeTag[210] = 10;
145 Dp_modeTag[211] = 11;
146 Dp_modeTag[212] = 12;
147 Dp_modeTag[213] = 13;
148 Dp_modeTag[214] = 14;
149 Dp_modeTag[215] = 15;
150 Dp_modeTag[216] = 16;
151 Dp_modeTag[217] = 17;
152 Dp_modeTag[218] = 18;
153 Dp_modeTag[219] = 19;
154 Dp_modeTag[220] = 20;
155 Dp_modeTag[221] = 21;
156 Dp_modeTag[222] = 22;
157 Dp_modeTag[223] = 23;
158 Dp_modeTag[224] = 24;
159 Dp_modeTag[225] = 24;
160 Dp_modeTag[226] = 25;
161 Dp_modeTag[227] = 25;
162 Dp_modeTag[228] = 26;
163 Dp_modeTag[229] = 27;
164 Dp_modeTag[230] = 28;
165 Dp_modeTag[231] = 29;
166 Dp_modeTag[232] = 29;
167 Dp_modeTag[233] = 29;
168 Dp_modeTag[234] = 29;
169 Dp_modeTag[235] = 29;
170 Dp_modeTag[236] = 29;
171 Dp_modeTag[237] = 29;
172 Dp_modeTag[238] = 29;
173 Dp_modeTag[239] = 29;
174 Dp_modeTag[240] = 29;
175 Dp_modeTag[241] = 29;
176 Dp_modeTag[242] = 29;
177 Dp_modeTag[290] = 30;
178 Dp_modeTag[291] = 30;
179 Dp_modeTag[292] = 30;
180 Dp_modeTag[293] = 30;
181 Dp_modeTag[294] = 30;
183 int NumCriteria = m_criteria.size();
184 if ( NumCriteria > 27 )
186 std::cout <<
"the number of criterias too much !" << std::endl;
187 return StatusCode::SUCCESS;
190 vector<string> name_cut;
191 vector<int> CutLc, CutDs, CutD0, CutD;
197 bool allLc =
false, allDs =
false, allD0 =
false, allD =
false, typeLc =
true, typeDs =
true,
198 typeD0 =
true, typeD =
true;
201 int nPos_1, nPos_2, nPos_3;
203 map<string, int> Cut1, Cut2;
204 for (
int i = 0; i < NumCriteria; i++ )
206 std::cout <<
"TagFilterSvc::criteria " << i <<
" : " << m_criteria[i] << endl;
207 nPos_1 = m_criteria[i].find_first_of(
"<" );
208 nPos_2 = m_criteria[i].find_last_of(
"<" );
209 nPos_3 = m_criteria[i].find_first_of(
"=" );
212 name = m_criteria[i].substr( 0, nPos_3 );
213 name_cut.push_back( name );
214 if ( name ==
"tagLc" )
215 { CutLc =
split( m_criteria[i].substr( nPos_3 + 1 ), pat, allLc, typeLc ); }
216 else if ( name ==
"tagDs" )
217 { CutDs =
split( m_criteria[i].substr( nPos_3 + 1 ), pat, allDs, typeDs ); }
218 else if ( name ==
"tagD0" )
219 { CutD0 =
split( m_criteria[i].substr( nPos_3 + 1 ), pat, allD0, typeD0 ); }
220 else if ( name ==
"tagD" )
221 { CutD =
split( m_criteria[i].substr( nPos_3 + 1 ), pat, allD, typeD ); }
224 std::cout <<
"pls check your tag criterias" << std::endl;
225 return StatusCode::SUCCESS;
228 else if ( nPos_1 == -1 || nPos_2 == -1 || nPos_1 == nPos_2 )
230 std::cout <<
"pls check your criterias" << std::endl;
231 return StatusCode::SUCCESS;
235 name = m_criteria[i].substr( nPos_1 + 1, nPos_2 - nPos_1 - 1 );
236 name_cut.push_back( name );
237 Cut1[name] = atoi( m_criteria[i].substr( 0 ).c_str() );
238 Cut2[name] = atoi( m_criteria[i].substr( nPos_2 + 1 ).c_str() );
242 TFile*
file = TFile::Open( m_fileName.c_str() );
243 TTree* t3 = (TTree*)
file->Get(
"Entries" );
244 UInt_t tagData0, tagData1, tagData2, tagData3, tagData4;
245 UInt_t tagData5, tagData6, tagData7, tagData8;
246 t3->SetBranchAddress(
"tagData0", &tagData0 );
247 t3->SetBranchAddress(
"tagData1", &tagData1 );
248 t3->SetBranchAddress(
"tagData2", &tagData2 );
249 t3->SetBranchAddress(
"tagData3", &tagData3 );
250 t3->SetBranchAddress(
"tagData4", &tagData4 );
251 t3->SetBranchAddress(
"tagData5", &tagData5 );
252 t3->SetBranchAddress(
"tagData6", &tagData6 );
253 t3->SetBranchAddress(
"tagData7", &tagData7 );
254 t3->SetBranchAddress(
"tagData8", &tagData8 );
256 Int_t npip, npim, nkp, nkm, nlambda, nalambda;
257 Int_t npp, npm, nep, nem, nmup, nmum, neta, npi0, ngamma, nks;
258 Int_t nGoodCharged, nCharged, nGoodChargedp, nGoodChargedm, totCharged, nNeutrk, nTottrk;
260 for (
int i = 0; i < t3->GetEntries(); i++ )
263 nGoodCharged = tagData0;
264 Tag1ToInt( tagData1, nNeutrk, nTottrk, ngamma, npi0 );
265 Tag2ToInt( tagData2, npip, npim, nkp, nkm, npp, npm );
266 Tag2ToInt( tagData3, nlambda, nalambda, nep, nem, nmup, nmum );
267 Tag2ToInt( tagData4, nks, neta, nCharged, nGoodChargedp, nGoodChargedm, totCharged );
269 unsigned int flag = 0;
272 for (
unsigned int j = 0; j < name_cut.size(); j++ )
274 if ( name_cut[j] ==
"tagLc" )
278 if ( !( tagData5 & ( 1 << 31 ) ) && typeLc )
break;
282 for (
unsigned int k = 0; k < CutLc.size(); k++ )
284 if ( tagData5 & ( 1 << Lc_modeTag[CutLc[k]] ) )
295 else if ( name_cut[j] ==
"tagDs" )
299 if ( !( tagData6 & ( 1 << 31 ) ) && typeDs )
break;
303 for (
unsigned int k = 0; k < CutDs.size(); k++ )
305 if ( tagData6 & ( 1 << Ds_modeTag[CutDs[k]] ) )
316 else if ( name_cut[j] ==
"tagD0" )
320 if ( !( tagData7 & ( 1 << 31 ) ) && typeD0 )
break;
324 for (
unsigned int k = 0; k < CutD0.size(); k++ )
326 if ( tagData7 & ( 1 << D0_modeTag[CutD0[k]] ) )
337 else if ( name_cut[j] ==
"tagD" )
341 if ( !( tagData8 & ( 1 << 31 ) ) && typeD )
break;
345 for (
unsigned int k = 0; k < CutD.size(); k++ )
347 if ( tagData8 & ( 1 << Dp_modeTag[CutD[k]] ) )
360 if ( name_cut[j] ==
"NumOfGoodCh" ) { tagvalue = nGoodCharged; }
361 else if ( name_cut[j] ==
"NumOfNeutrk" ) { tagvalue = nNeutrk; }
362 else if ( name_cut[j] ==
"NumOfTottrk" ) { tagvalue = nTottrk; }
363 else if ( name_cut[j] ==
"NumOfGamma" ) { tagvalue = ngamma; }
364 else if ( name_cut[j] ==
"NumOfPion0" ) { tagvalue = npi0; }
365 else if ( name_cut[j] ==
"NumOfPionp" ) { tagvalue = npip; }
366 else if ( name_cut[j] ==
"NumOfPionm" ) { tagvalue = npim; }
367 else if ( name_cut[j] ==
"NumOfKaonp" ) { tagvalue = nkp; }
368 else if ( name_cut[j] ==
"NumOfKaonm" ) { tagvalue = nkm; }
369 else if ( name_cut[j] ==
"NumOfProtonp" ) { tagvalue = npp; }
370 else if ( name_cut[j] ==
"NumOfProtonm" ) { tagvalue = npm; }
371 else if ( name_cut[j] ==
"NumOfLambda" ) { tagvalue = nlambda; }
372 else if ( name_cut[j] ==
"NumOfALambda" ) { tagvalue = nalambda; }
373 else if ( name_cut[j] ==
"NumOfElectronp" ) { tagvalue = nep; }
374 else if ( name_cut[j] ==
"NumOfElectronm" ) { tagvalue = nem; }
375 else if ( name_cut[j] ==
"NumOfMuonp" ) { tagvalue = nmup; }
376 else if ( name_cut[j] ==
"NumOfMuonm" ) { tagvalue = nmum; }
377 else if ( name_cut[j] ==
"NumOfKs" ) { tagvalue = nks; }
378 else if ( name_cut[j] ==
"NumOfEta" ) { tagvalue = neta; }
379 else if ( name_cut[j] ==
"NumOfCharged" ) { tagvalue = nCharged; }
380 else if ( name_cut[j] ==
"NumOfGoodChp" ) { tagvalue = nGoodChargedp; }
381 else if ( name_cut[j] ==
"NumOfGoodChm" ) { tagvalue = nGoodChargedm; }
382 else if ( name_cut[j] ==
"TotCharged" ) { tagvalue = totCharged; }
385 cout <<
"pls check the name of your criteria !" << endl;
388 if ( tagvalue >= Cut2[name_cut[j]] || tagvalue <= Cut1[name_cut[j]] )
break;
392 if (
flag == name_cut.size() ) { ventry.push_back( i ); }
400 return StatusCode::SUCCESS;