35 std::map<int, unsigned int> Ds_modeTag, D0_modeTag, Dp_modeTag;
100 D0_modeTag[119] = 27;
101 D0_modeTag[120] = 28;
102 D0_modeTag[121] = 29;
103 D0_modeTag[122] = 30;
104 D0_modeTag[123] = 30;
105 D0_modeTag[124] = 30;
106 D0_modeTag[125] = 30;
107 D0_modeTag[126] = 30;
108 D0_modeTag[127] = 30;
109 D0_modeTag[128] = 30;
110 D0_modeTag[129] = 30;
111 D0_modeTag[130] = 30;
112 D0_modeTag[131] = 30;
113 D0_modeTag[132] = 30;
114 D0_modeTag[133] = 30;
115 D0_modeTag[134] = 30;
116 D0_modeTag[135] = 30;
128 Dp_modeTag[210] = 10;
129 Dp_modeTag[211] = 11;
130 Dp_modeTag[212] = 12;
131 Dp_modeTag[213] = 13;
132 Dp_modeTag[214] = 14;
133 Dp_modeTag[215] = 15;
134 Dp_modeTag[216] = 16;
135 Dp_modeTag[217] = 17;
136 Dp_modeTag[218] = 18;
137 Dp_modeTag[219] = 19;
138 Dp_modeTag[220] = 20;
139 Dp_modeTag[221] = 21;
140 Dp_modeTag[222] = 22;
141 Dp_modeTag[223] = 23;
142 Dp_modeTag[224] = 24;
143 Dp_modeTag[225] = 24;
144 Dp_modeTag[226] = 25;
145 Dp_modeTag[227] = 25;
146 Dp_modeTag[228] = 26;
147 Dp_modeTag[229] = 27;
148 Dp_modeTag[230] = 28;
149 Dp_modeTag[231] = 29;
150 Dp_modeTag[232] = 29;
151 Dp_modeTag[233] = 29;
152 Dp_modeTag[234] = 29;
153 Dp_modeTag[235] = 29;
154 Dp_modeTag[236] = 29;
155 Dp_modeTag[237] = 29;
156 Dp_modeTag[238] = 29;
157 Dp_modeTag[239] = 29;
158 Dp_modeTag[240] = 29;
159 Dp_modeTag[241] = 29;
160 Dp_modeTag[242] = 29;
161 Dp_modeTag[290] = 30;
162 Dp_modeTag[291] = 30;
163 Dp_modeTag[292] = 30;
164 Dp_modeTag[293] = 30;
165 Dp_modeTag[294] = 30;
167 int NumCriteria = m_criteria.size();
168 if (NumCriteria>27) {
169 std::cout<<
"the number of criterias too much !"<<std::endl;
170 return StatusCode::SUCCESS;
173 unsigned int Ncut_oth=0;
174 vector<string> name_tag, name_oth;
175 vector<int> CutDs, CutD0, CutD;
181 bool allDs=
false, allD0=
false, allD=
false, typeDs=
true, typeD0=
true, typeD=
true, QC=
false;
184 int nPos_1, nPos_2, nPos_3, nPos_4;
186 map<string, int> Cut1, Cut2;
187 for (
int i=0; i<NumCriteria; i++) {
188 std::cout<<
"TagFilterSvc::criteria " << i <<
" : " << m_criteria[i];
189 nPos_1 = m_criteria[i].find_first_of(
"<");
190 nPos_2 = m_criteria[i].find_last_of(
"<");
191 nPos_3 = m_criteria[i].find_first_of(
"=");
192 nPos_4 = m_criteria[i].find(
"QCon");
195 cout <<
" -> Turn on QC";
197 else if (nPos_3!=-1) {
198 name = m_criteria[i].substr(0,nPos_3);
199 name_tag.push_back(name);
201 CutDs =
split(m_criteria[i].substr(nPos_3+1),pat, allDs, typeDs);
202 }
else if (name==
"tagD0") {
203 CutD0 =
split(m_criteria[i].substr(nPos_3+1),pat, allD0, typeD0);
204 }
else if (name==
"tagD") {
205 CutD =
split(m_criteria[i].substr(nPos_3+1),pat, allD, typeD);
207 std::cout<<
"pls check your tag criterias"<<std::endl;
208 return StatusCode::SUCCESS;
211 else if (nPos_1==-1 || nPos_2==-1 || nPos_1==nPos_2) {
212 std::cout<<
"pls check your criterias"<<std::endl;
213 return StatusCode::SUCCESS;
216 name = m_criteria[i].substr(nPos_1+1,nPos_2-nPos_1-1);
217 name_oth.push_back(name);
219 Cut1[name] = atoi(m_criteria[i].substr(0).c_str());
220 Cut2[name] = atoi(m_criteria[i].substr(nPos_2+1).c_str());
222 std::cout<<std::endl;
225 TFile*
file = TFile::Open( m_fileName.c_str() );
226 TTree* t3 = (TTree*)
file->Get(
"Entries");
227 UInt_t tagData0, tagData1, tagData2, tagData3, tagData4;
228 UInt_t tagData5, tagData6, tagData7, tagData8;
229 t3->SetBranchAddress(
"tagData0", &tagData0);
230 t3->SetBranchAddress(
"tagData1", &tagData1);
231 t3->SetBranchAddress(
"tagData2", &tagData2);
232 t3->SetBranchAddress(
"tagData3", &tagData3);
233 t3->SetBranchAddress(
"tagData4", &tagData4);
234 t3->SetBranchAddress(
"tagData5", &tagData5);
235 t3->SetBranchAddress(
"tagData6", &tagData6);
236 t3->SetBranchAddress(
"tagData7", &tagData7);
237 t3->SetBranchAddress(
"tagData8", &tagData8);
239 Int_t npip, npim, nkp, nkm, nlambda, nalambda;
240 Int_t npp, npm, nep, nem, nmup, nmum, neta, npi0, ngamma, nks;
241 Int_t nGoodCharged, nCharged, nGoodChargedp, nGoodChargedm, totCharged, nNeutrk, nTottrk;
245 for (
int i=0;i<t3->GetEntries();i++ ) {
247 nGoodCharged = tagData0;
248 Tag1ToInt(tagData1, nNeutrk, nTottrk, ngamma, npi0);
249 Tag2ToInt(tagData2, npip, npim, nkp, nkm, npp, npm);
250 Tag2ToInt(tagData3, nlambda, nalambda, nep, nem, nmup, nmum);
251 Tag2ToInt(tagData4, nks, neta, nCharged, nGoodChargedp, nGoodChargedm, totCharged);
253 if ( QC && tagData8==0 )
continue;
254 if ( name_tag.size()==0 && Ncut_oth==0 ) {
259 for (
unsigned int j=0; j<name_tag.size(); j++ ) {
260 if (name_tag[j]==
"tagD0") {
263 if ( !(tagData6&(1<<31)) && typeD0 ) isPID =
false;
266 for (
unsigned int k=0; k<CutD0.size(); k++) {
267 if ( tagData6&(1<<D0_modeTag[CutD0[k]]) ) {
278 else if (name_tag[j]==
"tagD") {
281 if ( !(tagData7&(1<<31)) && typeD ) isPID =
false;
284 for (
unsigned int k=0; k<CutD.size(); k++) {
285 if ( tagData7&(1<<Dp_modeTag[CutD[k]]) ) {
296 else if (name_tag[j]==
"tagDs") {
299 if ( !(tagData5&(1<<31)) && typeDs ) isPID =
false;
302 for (
unsigned int k=0; k<CutDs.size(); k++) {
303 if ( tagData5&(1<<Ds_modeTag[CutDs[k]]) ) {
323 for (
unsigned int j=0; j<name_oth.size(); j++ ) {
324 if (name_oth[j]==
"NumOfGoodCh") {tagvalue = nGoodCharged;}
325 else if (name_oth[j]==
"NumOfNeutrk") {tagvalue = nNeutrk;}
326 else if (name_oth[j]==
"NumOfTottrk") {tagvalue = nTottrk;}
327 else if (name_oth[j]==
"NumOfGamma") {tagvalue = ngamma;}
328 else if (name_oth[j]==
"NumOfPion0") {tagvalue = npi0;}
329 else if (name_oth[j]==
"NumOfPionp") {tagvalue = npip;}
330 else if (name_oth[j]==
"NumOfPionm") {tagvalue = npim;}
331 else if (name_oth[j]==
"NumOfKaonp") {tagvalue = nkp;}
332 else if (name_oth[j]==
"NumOfKaonm") {tagvalue = nkm;}
333 else if (name_oth[j]==
"NumOfProtonp") {tagvalue = npp;}
334 else if (name_oth[j]==
"NumOfProtonm") {tagvalue = npm;}
335 else if (name_oth[j]==
"NumOfLambda") {tagvalue = nlambda;}
336 else if (name_oth[j]==
"NumOfALambda" ) {tagvalue = nalambda;}
337 else if (name_oth[j]==
"NumOfElectronp") {tagvalue = nep;}
338 else if (name_oth[j]==
"NumOfElectronm") {tagvalue = nem;}
339 else if (name_oth[j]==
"NumOfMuonp") {tagvalue = nmup;}
340 else if (name_oth[j]==
"NumOfMuonm") {tagvalue = nmum;}
341 else if (name_oth[j]==
"NumOfKs") {tagvalue = nks;}
342 else if (name_oth[j]==
"NumOfEta") {tagvalue = neta;}
343 else if (name_oth[j]==
"NumOfCharged") {tagvalue = nCharged;}
344 else if (name_oth[j]==
"NumOfGoodChp") {tagvalue = nGoodChargedp;}
345 else if (name_oth[j]==
"NumOfGoodChm") {tagvalue = nGoodChargedm;}
346 else if (name_oth[j]==
"TotCharged") {tagvalue = totCharged;}
348 cout <<
"pls check the name of your criteria !" << endl;
351 if ( tagvalue>=Cut2[name_oth[j]] || tagvalue<=Cut1[name_oth[j]] )
break;
354 if (Ncut_oth>0&&Ncut_oth==
flag) ventry.push_back(i);
356 cout <<
"TagFilterSvc::" << ventry.size() <<
" out of " << t3->GetEntries() <<
" events selected" << endl;
363 return StatusCode::SUCCESS;