41 #include <EVENT/LCCollection.h>
48 #include "EVENT/ReconstructedParticle.h"
49 #include "IMPL/ClusterImpl.h"
54 #include "TMVA/Tools.h"
55 #include "TMVA/Reader.h"
62 reader =
new TMVA::Reader(
"Silent");
65 reader->AddVariable(
"Dclus", &Dclus);
66 reader->AddVariable(
"EclOvPtr", &EclOvPtr);
67 reader->AddVariable(
"Rmean", &Rmean);
68 reader->AddVariable(
"Rrms", &Rrms);
71 std::vector<std::string> Pvalue;
72 Pvalue.push_back(
"02GeVP");
73 Pvalue.push_back(
"03GeVP");
74 Pvalue.push_back(
"04GeVP");
75 Pvalue.push_back(
"05GeVP");
76 Pvalue.push_back(
"06GeVP");
77 Pvalue.push_back(
"07GeVP");
78 Pvalue.push_back(
"08GeVP");
79 Pvalue.push_back(
"09GeVP");
80 Pvalue.push_back(
"10GeVP");
81 Pvalue.push_back(
"11GeVP");
82 Pvalue.push_back(
"12GeVP");
83 Pvalue.push_back(
"13GeVP");
84 Pvalue.push_back(
"14GeVP");
85 Pvalue.push_back(
"15GeVP");
86 Pvalue.push_back(
"16GeVP");
87 Pvalue.push_back(
"17GeVP");
88 Pvalue.push_back(
"18GeVP");
89 Pvalue.push_back(
"19GeVP");
90 Pvalue.push_back(
"20GeVP");
95 for(
int i=0; i < 19; i++){
96 myMethod =
"BDTG_"+ Pvalue[i]+
"_clusterinfo";
97 weightfile = fname[i];
98 reader->BookMVA( myMethod, weightfile );
113 Float_t cut02 = -0.0093;
114 Float_t cut03 = -0.1344;
115 Float_t cut04 = -0.0118;
116 Float_t cut05 = -0.0965 ;
117 Float_t cut06 = -0.2278;
118 Float_t cut07 = 0.0030;
119 Float_t cut08 = -0.1708;
120 Float_t cut09 = 0.0060;
121 Float_t cut10 = -0.1957;
122 Float_t cut11 = -0.3255;
123 Float_t cut12 = -0.1523;
124 Float_t cut13 = -0.1290;
125 Float_t cut14 = -0.1301;
126 Float_t cut15 = -0.1729;
127 Float_t cut16 = -0.1704;
128 Float_t cut17 = -0.1978;
129 Float_t cut18 = -0.0110;
130 Float_t cut19 = -0.1871;
131 Float_t cut20 = -0.2328;
136 if(cluvec.size()!=0){
137 shapes=cluvec[0]->getShape();
144 float chene[10000]={0};
145 float chpox[10000]={0};
146 float chpoy[10000]={0};
147 float chpoz[10000]={0};
152 float Rhits2_clu = 0;
153 float rsum_2cluster =0;
154 float r2sum_2cluster =0;
155 float isum_2cluster =0;
157 float cosalphacluster=0;
160 const EVENT::TrackStateVec & tss = trk->getTrackStates() ;
162 const lcio::TrackState* ts ;
164 ts = trk->getTrackState( lcio::TrackState::AtCalorimeter ) ;
166 float tscpx = ts->getReferencePoint()[0] ;
167 float tscpy = ts->getReferencePoint()[1] ;
168 float tscpz = ts->getReferencePoint()[2] ;
170 for(
size_t iclu=0; iclu < cluvec.size(); iclu++){
173 if(cluvec[iclu]->getEnergy() > Eclu){
174 Eclu=cluvec[iclu]->getEnergy();
175 clene = cluvec[iclu]->getEnergy();
176 clpox = cluvec[iclu]->getPosition()[0];
177 clpoy = cluvec[iclu]->getPosition()[1];
178 clpoz = cluvec[iclu]->getPosition()[2];
180 EVENT::CalorimeterHitVec tempvec= cluvec[iclu]->getCalorimeterHits();
183 for(
unsigned jhit=0; jhit < nch ; ++jhit ) {
184 nhit = tempvec.size();
185 chene[jhit] = tempvec[jhit]->getEnergy();
186 chpox[jhit] = tempvec[jhit]->getPosition()[0];
187 chpoy[jhit] = tempvec[jhit]->getPosition()[1];
188 chpoz[jhit] = tempvec[jhit]->getPosition()[2];
192 for(
size_t iclu=0; iclu < cluvec.size(); iclu++){
193 for(
unsigned jhit=0; jhit < nch ; ++jhit ) {
195 Rhits_clu=sqrt(pow(chpox[jhit]-clpox,2)+pow(chpoy[jhit]-clpoy,2));
196 Rhits2_clu=pow(chpox[jhit]-clpox,2)+pow(chpoy[jhit]-clpoy,2);
198 rsum_2cluster +=Rhits_clu;
199 r2sum_2cluster += Rhits2_clu;
200 isum_2cluster = m_clu++;
205 if(abs(clpoz) > 2450){
207 cosalphacluster = (clpoz - tscpz)/(sqrt(pow(clpox -tscpx,2)+pow(clpoy - tscpy,2)+pow(clpoz- tscpz,2)));
208 Dclus = (clpoz - tscpz)/cosalphacluster;
209 EclOvPtr = clene/pp.P();
210 Rmean = rsum_2cluster/isum_2cluster;
211 Rrms = sqrt(r2sum_2cluster/isum_2cluster);
221 if(shapes.size()!=0){
222 if(Dclus!=0 && EclOvPtr!=0 && Rmean !=0 && Rrms!=0){
223 if(0.15< pp.P() && pp.P()<= 0.25){
224 mvaout = reader->EvaluateMVA(
"BDTG_02GeVP_clusterinfo");
225 if(mvaout > cut02) tmpid=1;
228 else if(0.25< pp.P() && pp.P()<=0.35){
229 mvaout = reader->EvaluateMVA(
"BDTG_03GeVP_clusterinfo");
230 if(mvaout > cut03) tmpid=1;
233 else if(0.35< pp.P() && pp.P()<=0.45){
234 mvaout = reader->EvaluateMVA(
"BDTG_04GeVP_clusterinfo");
235 if(mvaout > cut04) tmpid=1;
238 else if(0.45< pp.P() && pp.P()<=0.55){
239 mvaout = reader->EvaluateMVA(
"BDTG_05GeVP_clusterinfo");
240 if(mvaout > cut05) tmpid=1;
243 else if(0.55< pp.P() && pp.P()<=0.65){
244 mvaout = reader->EvaluateMVA(
"BDTG_06GeVP_clusterinfo");
245 if(mvaout > cut06) tmpid=1;
248 else if(0.65< pp.P() && pp.P()<=0.75){
249 mvaout = reader->EvaluateMVA(
"BDTG_07GeVP_clusterinfo");
250 if(mvaout > cut07) tmpid=1;
253 else if(0.75< pp.P() && pp.P()<=0.85){
254 mvaout = reader->EvaluateMVA(
"BDTG_08GeVP_clusterinfo");
255 if(mvaout > cut08) tmpid=1;
258 else if(0.85< pp.P() && pp.P()<=0.95){
259 mvaout = reader->EvaluateMVA(
"BDTG_09GeVP_clusterinfo");
260 if(mvaout > cut09) tmpid=1;
263 else if(0.95< pp.P() && pp.P()<=1.05){
264 mvaout = reader->EvaluateMVA(
"BDTG_10GeVP_clusterinfo");
265 if(mvaout > cut10) tmpid=1;
268 else if(1.05< pp.P() && pp.P()<=1.15){
269 mvaout = reader->EvaluateMVA(
"BDTG_11GeVP_clusterinfo");
270 if(mvaout > cut11) tmpid=1;
273 else if(1.15< pp.P() && pp.P()<=1.25){
274 mvaout = reader->EvaluateMVA(
"BDTG_12GeVP_clusterinfo");
275 if(mvaout > cut12) tmpid=1;
278 else if(1.25< pp.P() && pp.P()<=1.35){
279 mvaout = reader->EvaluateMVA(
"BDTG_13GeVP_clusterinfo");
280 if(mvaout > cut13) tmpid=1;
283 else if(1.35< pp.P() && pp.P()<=1.45){
284 mvaout = reader->EvaluateMVA(
"BDTG_14GeVP_clusterinfo");
285 if(mvaout > cut14) tmpid=1;
288 else if(1.45< pp.P() && pp.P()<=1.55){
289 mvaout = reader->EvaluateMVA(
"BDTG_15GeVP_clusterinfo");
290 if(mvaout > cut15) tmpid=1;
293 else if(1.55< pp.P() && pp.P()<=1.65){
294 mvaout = reader->EvaluateMVA(
"BDTG_16GeVP_clusterinfo");
295 if(mvaout > cut16) tmpid=1;
298 else if(1.65< pp.P() && pp.P()<=1.75){
299 mvaout = reader->EvaluateMVA(
"BDTG_17GeVP_clusterinfo");
300 if(mvaout > cut17) tmpid=1;
303 else if(1.75< pp.P() && pp.P()<=1.85){
304 mvaout = reader->EvaluateMVA(
"BDTG_18GeVP_clusterinfo");
305 if(mvaout > cut18) tmpid=1;
308 else if(1.85< pp.P() && pp.P()<=1.95){
309 mvaout = reader->EvaluateMVA(
"BDTG_19GeVP_clusterinfo");
310 if(mvaout > cut19) tmpid=1;
313 else if(1.95< pp.P() && pp.P()<=2.05){
314 mvaout = reader->EvaluateMVA(
"BDTG_20GeVP_clusterinfo");
315 if(mvaout > cut20) tmpid=1;
318 else mvaout = -100.0;
LowMomentumMuPiSeparationPID_BDTG(const LowMomentumMuPiSeparationPID_BDTG &)=delete
~LowMomentumMuPiSeparationPID_BDTG()
Int_t MuPiSeparation(TLorentzVector pp, EVENT::Track *trk, EVENT::ClusterVec &cluvec)