32 int NumCriteria = m_criteria.size();
33 if ( NumCriteria > 23 )
35 std::cout <<
"the number of criterias too much!!" << std::endl;
36 return StatusCode::SUCCESS;
38 if ( m_criteria[0].find(
"<NumOfGoodCh<" ) == std::string::npos )
40 std::cout <<
"pls ensure your first criterias is NumOfCharged" << std::endl;
41 return StatusCode::SUCCESS;
44 vector<string> criteria;
45 map<string, int> Cut1;
46 map<string, int> Cut2;
47 for (
int i = 0; i < NumCriteria; i++ )
49 int nPos_1 = m_criteria[i].find_first_of(
"<" );
50 int nPos_2 = m_criteria[i].find_last_of(
"<" );
51 if ( nPos_1 == nPos_2 || nPos_1 == -1 || nPos_2 == -1 )
53 std::cout <<
"pls check your criterias" << std::endl;
54 return StatusCode::SUCCESS;
56 string name_cut = m_criteria[i].substr( nPos_1 + 1, nPos_2 - nPos_1 - 1 );
57 Cut1[name_cut] = atoi( m_criteria[i].substr( 0 ).c_str() );
58 Cut2[name_cut] = atoi( m_criteria[i].substr( nPos_2 + 1 ).c_str() );
59 criteria.push_back( name_cut );
60 std::cout <<
"criteria is " << criteria[i] << std::endl;
61 std::cout <<
"nCTrkCut1: " << Cut1[criteria[i]] <<
" nCTrkCut2: " << Cut2[criteria[i]]
71 std::vector<int> ventry_temp;
73 TFile*
file = TFile::Open( m_fileName.c_str() );
74 TTree* t0 = (TTree*)
file->Get(
"Metadata" );
75 Int_t mode, begin, end;
76 t0->SetBranchAddress(
"mode", &mode );
77 t0->SetBranchAddress(
"begin", &begin );
78 t0->SetBranchAddress(
"end", &end );
80 for (
int i = 0; i < t0->GetEntries(); ++i )
83 std::cout <<
"t0 entry: " << i << std::endl;
84 if ( ( mode != -1 ) && ( mode > Cut1[
"NumOfGoodCh"] && mode < Cut2[
"NumOfGoodCh"] ) )
86 for (
int i = begin; i < end; ++i )
88 ventry_temp.push_back( i );
95 TTree* t3 = (TTree*)
file->Get(
"Entries" );
96 UInt_t tagData0, tagData1, tagData2, tagData3, tagData4;
97 t3->SetBranchAddress(
"tagData0", &tagData0 );
98 t3->SetBranchAddress(
"tagData1", &tagData1 );
99 t3->SetBranchAddress(
"tagData2", &tagData2 );
100 t3->SetBranchAddress(
"tagData3", &tagData3 );
101 t3->SetBranchAddress(
"tagData4", &tagData4 );
103 Int_t npip, npim, nkp, nkm, nlambda, nalambda;
104 Int_t npp, npm, nep, nem, nmup, nmum, neta, npi0, ngamma, nks;
105 Int_t nCharged, nGoodChargedp, nGoodChargedm, totCharged, nNeutrk, nTottrk;
106 for (
int i = 0; i < ventry_temp.size(); i++ )
108 t3->GetEntry( ventry_temp[i] );
109 Tag1ToInt( tagData1, nNeutrk, nTottrk, ngamma, npi0 );
110 Tag2ToInt( tagData2, npip, npim, nkp, nkm, npp, npm );
111 Tag2ToInt( tagData3, nlambda, nalambda, nep, nem, nmup, nmum );
112 Tag2ToInt( tagData4, nks, neta, nCharged, nGoodChargedp, nGoodChargedm, totCharged );
117 if ( Cut2[
"NumOfNeutrk"] != 0 &&
118 ( nNeutrk >= Cut2[
"NumOfNeutrk"] || nNeutrk <= Cut1[
"NumOfNeutrk"] ) )
120 if ( Cut2[
"NumOfTottrk"] != 0 &&
121 ( nTottrk >= Cut2[
"NumOfTottrk"] || nTottrk <= Cut1[
"NumOfTottrk"] ) )
123 if ( Cut2[
"NumOfGamma"] != 0 &&
124 ( ngamma >= Cut2[
"NumOfGamma"] || ngamma <= Cut1[
"NumOfGamma"] ) )
126 if ( Cut2[
"NumOfPion0"] != 0 &&
127 ( npi0 >= Cut2[
"NumOfPion0"] || npi0 <= Cut1[
"NumOfPion0"] ) )
129 if ( Cut2[
"NumOfPionp"] != 0 &&
130 ( npip >= Cut2[
"NumOfPionp"] || npip <= Cut1[
"NumOfPionp"] ) )
132 if ( Cut2[
"NumOfPionm"] != 0 &&
133 ( npim >= Cut2[
"NumOfPionm"] || npim <= Cut1[
"NumOfPionm"] ) )
135 if ( Cut2[
"NumOfKaonp"] != 0 &&
136 ( nkp >= Cut2[
"NumOfKaonp"] || nkp <= Cut1[
"NumOfKaonp"] ) )
138 if ( Cut2[
"NumOfKaonm"] != 0 &&
139 ( nkm >= Cut2[
"NumOfKaonm"] || nkm <= Cut1[
"NumOfKaonm"] ) )
141 if ( Cut2[
"NumOfProtonp"] != 0 &&
142 ( npp >= Cut2[
"NumOfProtonp"] || npp <= Cut1[
"NumOfProtonp"] ) )
144 if ( Cut2[
"NumOfProtonm"] != 0 &&
145 ( npm >= Cut2[
"NumOfProtonm"] || npp <= Cut1[
"NumOfProtonm"] ) )
147 if ( Cut2[
"NumOfLambda"] != 0 &&
148 ( nlambda >= Cut2[
"NumOfLambda"] || nlambda <= Cut1[
"NumOfLambda"] ) )
150 if ( Cut2[
"NumOfALambda"] != 0 &&
151 ( nalambda >= Cut2[
"NumOfALambda"] || nalambda <= Cut1[
"NumOfALambda"] ) )
153 if ( Cut2[
"NumOfElectronp"] != 0 &&
154 ( nep >= Cut2[
"NumOfElectronp"] || nep <= Cut1[
"NumOfElectronp"] ) )
156 if ( Cut2[
"NumOfElectronm"] != 0 &&
157 ( nem >= Cut2[
"NumOfElectronm"] || nem <= Cut1[
"NumOfElectronm"] ) )
159 if ( Cut2[
"NumOfMuonp"] != 0 &&
160 ( nmup >= Cut2[
"NumOfMuonp"] || nmup <= Cut1[
"NumOfMuonp"] ) )
162 if ( Cut2[
"NumOfMuonm"] != 0 &&
163 ( nmum >= Cut2[
"NumOfMuonm"] || nmum <= Cut1[
"NumOfMuonm"] ) )
165 if ( Cut2[
"NumOfKs"] != 0 && ( nks >= Cut2[
"NumOfKs"] || nks <= Cut1[
"NumOfKs"] ) )
167 if ( Cut2[
"NumOfEta"] != 0 && ( neta >= Cut2[
"NumOfEta"] || neta <= Cut1[
"NumOfEta"] ) )
169 if ( Cut2[
"NumOfCharged"] != 0 &&
170 ( nCharged >= Cut2[
"NumOfCharged"] || nCharged <= Cut1[
"NumOfCharged"] ) )
172 if ( Cut2[
"NumOfGoodChp"] != 0 &&
173 ( nGoodChargedp >= Cut2[
"NumOfGoodChp"] || nGoodChargedp <= Cut1[
"NumOfGoodChp"] ) )
175 if ( Cut2[
"NumOfGoodChm"] != 0 &&
176 ( nGoodChargedm >= Cut2[
"NumOfGoodChm"] || nGoodChargedm <= Cut1[
"NumOfGoodChm"] ) )
178 if ( Cut2[
"TotCharged"] != 0 &&
179 ( totCharged >= Cut2[
"TotCharged"] || totCharged <= Cut1[
"TotCharged"] ) )
181 ventry.push_back( ventry_temp[i] );
186 return StatusCode::SUCCESS;