35 std::map<int, unsigned int> Lc_modeTag, Ds_modeTag, D0_modeTag, Dp_modeTag;
47 Lc_modeTag[1034] = 10;
48 Lc_modeTag[1060] = 11;
49 Lc_modeTag[1061] = 12;
50 Lc_modeTag[1062] = 13;
51 Lc_modeTag[1063] = 14;
52 Lc_modeTag[1064] = 15;
53 Lc_modeTag[1065] = 16;
100 D0_modeTag[100] = 12;
101 D0_modeTag[101] = 13;
102 D0_modeTag[102] = 14;
103 D0_modeTag[103] = 15;
104 D0_modeTag[104] = 16;
105 D0_modeTag[105] = 16;
106 D0_modeTag[106] = 17;
107 D0_modeTag[107] = 16;
108 D0_modeTag[108] = 16;
109 D0_modeTag[109] = 18;
110 D0_modeTag[110] = 19;
111 D0_modeTag[111] = 20;
112 D0_modeTag[112] = 16;
113 D0_modeTag[113] = 21;
114 D0_modeTag[114] = 22;
115 D0_modeTag[115] = 23;
116 D0_modeTag[116] = 24;
117 D0_modeTag[117] = 25;
118 D0_modeTag[118] = 26;
119 D0_modeTag[119] = 27;
120 D0_modeTag[120] = 28;
121 D0_modeTag[121] = 29;
122 D0_modeTag[122] = 30;
123 D0_modeTag[123] = 30;
124 D0_modeTag[124] = 30;
125 D0_modeTag[125] = 30;
126 D0_modeTag[126] = 30;
127 D0_modeTag[127] = 30;
128 D0_modeTag[128] = 30;
129 D0_modeTag[129] = 30;
130 D0_modeTag[130] = 30;
131 D0_modeTag[131] = 30;
132 D0_modeTag[132] = 30;
133 D0_modeTag[133] = 30;
134 D0_modeTag[134] = 30;
135 D0_modeTag[135] = 30;
147 Dp_modeTag[210] = 10;
148 Dp_modeTag[211] = 11;
149 Dp_modeTag[212] = 12;
150 Dp_modeTag[213] = 13;
151 Dp_modeTag[214] = 14;
152 Dp_modeTag[215] = 15;
153 Dp_modeTag[216] = 16;
154 Dp_modeTag[217] = 17;
155 Dp_modeTag[218] = 18;
156 Dp_modeTag[219] = 19;
157 Dp_modeTag[220] = 20;
158 Dp_modeTag[221] = 21;
159 Dp_modeTag[222] = 22;
160 Dp_modeTag[223] = 23;
161 Dp_modeTag[224] = 24;
162 Dp_modeTag[225] = 24;
163 Dp_modeTag[226] = 25;
164 Dp_modeTag[227] = 25;
165 Dp_modeTag[228] = 26;
166 Dp_modeTag[229] = 27;
167 Dp_modeTag[230] = 28;
168 Dp_modeTag[231] = 29;
169 Dp_modeTag[232] = 29;
170 Dp_modeTag[233] = 29;
171 Dp_modeTag[234] = 29;
172 Dp_modeTag[235] = 29;
173 Dp_modeTag[236] = 29;
174 Dp_modeTag[237] = 29;
175 Dp_modeTag[238] = 29;
176 Dp_modeTag[239] = 29;
177 Dp_modeTag[240] = 29;
178 Dp_modeTag[241] = 29;
179 Dp_modeTag[242] = 29;
180 Dp_modeTag[290] = 30;
181 Dp_modeTag[291] = 30;
182 Dp_modeTag[292] = 30;
183 Dp_modeTag[293] = 30;
184 Dp_modeTag[294] = 30;
186 int NumCriteria = m_criteria.size();
187 if (NumCriteria>27) {
188 std::cout<<
"the number of criterias too much !"<<std::endl;
189 return StatusCode::SUCCESS;
192 vector<string> name_cut;
193 vector<int> CutLc, CutDs, CutD0, CutD;
199 bool allLc=
false, allDs=
false, allD0=
false, allD=
false, typeLc=
true, typeDs=
true, typeD0=
true, typeD=
true;
202 int nPos_1, nPos_2, nPos_3;
204 map<string, int> Cut1, Cut2;
205 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(
"=");
211 name = m_criteria[i].substr(0,nPos_3);
212 name_cut.push_back(name);
214 CutLc =
split(m_criteria[i].substr(nPos_3+1),pat, allLc, typeLc);
215 }
else if (name==
"tagDs") {
216 CutDs =
split(m_criteria[i].substr(nPos_3+1),pat, allDs, typeDs);
217 }
else if (name==
"tagD0") {
218 CutD0 =
split(m_criteria[i].substr(nPos_3+1),pat, allD0, typeD0);
219 }
else if (name==
"tagD") {
220 CutD =
split(m_criteria[i].substr(nPos_3+1),pat, allD, typeD);
222 std::cout<<
"pls check your tag criterias"<<std::endl;
223 return StatusCode::SUCCESS;
226 else if (nPos_1==-1 || nPos_2==-1 || nPos_1==nPos_2) {
227 std::cout<<
"pls check your criterias"<<std::endl;
228 return StatusCode::SUCCESS;
231 name = m_criteria[i].substr(nPos_1+1,nPos_2-nPos_1-1);
232 name_cut.push_back(name);
233 Cut1[name] = atoi(m_criteria[i].substr(0).c_str());
234 Cut2[name] = atoi(m_criteria[i].substr(nPos_2+1).c_str());
238 TFile*
file = TFile::Open( m_fileName.c_str() );
239 TTree* t3 = (TTree*)
file->Get(
"Entries");
240 UInt_t tagData0, tagData1, tagData2, tagData3, tagData4;
241 UInt_t tagData5, tagData6, tagData7, tagData8;
242 t3->SetBranchAddress(
"tagData0", &tagData0);
243 t3->SetBranchAddress(
"tagData1", &tagData1);
244 t3->SetBranchAddress(
"tagData2", &tagData2);
245 t3->SetBranchAddress(
"tagData3", &tagData3);
246 t3->SetBranchAddress(
"tagData4", &tagData4);
247 t3->SetBranchAddress(
"tagData5", &tagData5);
248 t3->SetBranchAddress(
"tagData6", &tagData6);
249 t3->SetBranchAddress(
"tagData7", &tagData7);
250 t3->SetBranchAddress(
"tagData8", &tagData8);
252 Int_t npip, npim, nkp, nkm, nlambda, nalambda;
253 Int_t npp, npm, nep, nem, nmup, nmum, neta, npi0, ngamma, nks;
254 Int_t nGoodCharged, nCharged, nGoodChargedp, nGoodChargedm, totCharged, nNeutrk, nTottrk;
256 for (
int i=0;i<t3->GetEntries();i++ ) {
258 nGoodCharged = tagData0;
259 Tag1ToInt(tagData1, nNeutrk, nTottrk, ngamma, npi0);
260 Tag2ToInt(tagData2, npip, npim, nkp, nkm, npp, npm);
261 Tag2ToInt(tagData3, nlambda, nalambda, nep, nem, nmup, nmum);
262 Tag2ToInt(tagData4, nks, neta, nCharged, nGoodChargedp, nGoodChargedm, totCharged);
264 unsigned int flag = 0;
267 for (
unsigned int j=0; j<name_cut.size(); j++ ) {
268 if (name_cut[j]==
"tagLc") {
270 if ( !(tagData5&(1<<31)) && typeLc )
break;
273 for (
unsigned int k=0; k<CutLc.size(); k++) {
274 if ( tagData5&(1<<Lc_modeTag[CutLc[k]]) ) {
285 else if (name_cut[j]==
"tagDs") {
287 if ( !(tagData6&(1<<31)) && typeDs )
break;
290 for (
unsigned int k=0; k<CutDs.size(); k++) {
291 if ( tagData6&(1<<Ds_modeTag[CutDs[k]]) ) {
302 else if (name_cut[j]==
"tagD0") {
304 if ( !(tagData7&(1<<31)) && typeD0 )
break;
307 for (
unsigned int k=0; k<CutD0.size(); k++) {
308 if ( tagData7&(1<<D0_modeTag[CutD0[k]]) ) {
319 else if (name_cut[j]==
"tagD") {
321 if ( !(tagData8&(1<<31)) && typeD )
break;
324 for (
unsigned int k=0; k<CutD.size(); k++) {
325 if ( tagData8&(1<<Dp_modeTag[CutD[k]]) ) {
337 if (name_cut[j]==
"NumOfGoodCh") {tagvalue = nGoodCharged;}
338 else if (name_cut[j]==
"NumOfNeutrk") {tagvalue = nNeutrk;}
339 else if (name_cut[j]==
"NumOfTottrk") {tagvalue = nTottrk;}
340 else if (name_cut[j]==
"NumOfGamma") {tagvalue = ngamma;}
341 else if (name_cut[j]==
"NumOfPion0") {tagvalue = npi0;}
342 else if (name_cut[j]==
"NumOfPionp") {tagvalue = npip;}
343 else if (name_cut[j]==
"NumOfPionm") {tagvalue = npim;}
344 else if (name_cut[j]==
"NumOfKaonp") {tagvalue = nkp;}
345 else if (name_cut[j]==
"NumOfKaonm") {tagvalue = nkm;}
346 else if (name_cut[j]==
"NumOfProtonp") {tagvalue = npp;}
347 else if (name_cut[j]==
"NumOfProtonm") {tagvalue = npm;}
348 else if (name_cut[j]==
"NumOfLambda") {tagvalue = nlambda;}
349 else if (name_cut[j]==
"NumOfALambda" ) {tagvalue = nalambda;}
350 else if (name_cut[j]==
"NumOfElectronp") {tagvalue = nep;}
351 else if (name_cut[j]==
"NumOfElectronm") {tagvalue = nem;}
352 else if (name_cut[j]==
"NumOfMuonp") {tagvalue = nmup;}
353 else if (name_cut[j]==
"NumOfMuonm") {tagvalue = nmum;}
354 else if (name_cut[j]==
"NumOfKs") {tagvalue = nks;}
355 else if (name_cut[j]==
"NumOfEta") {tagvalue = neta;}
356 else if (name_cut[j]==
"NumOfCharged") {tagvalue = nCharged;}
357 else if (name_cut[j]==
"NumOfGoodChp") {tagvalue = nGoodChargedp;}
358 else if (name_cut[j]==
"NumOfGoodChm") {tagvalue = nGoodChargedm;}
359 else if (name_cut[j]==
"TotCharged") {tagvalue = totCharged;}
361 cout <<
"pls check the name of your criteria !" << endl;
364 if ( tagvalue>=Cut2[name_cut[j]] || tagvalue<=Cut1[name_cut[j]] )
break;
368 if (
flag==name_cut.size()) {
378 return StatusCode::SUCCESS;