11 #include "TLorentzVector.h"
16 #include <trackbase_historic/SvtxVertex.h>
17 #include <trackbase_historic/SvtxVertexMap.h>
23 #include <calobase/RawClusterContainer.h>
24 #include <calobase/RawCluster.h>
25 #include <calobase/RawClusterv1.h>
42 #include "trackpidassoc/TrackPidAssoc.h"
74 _rng =
new TRandom2();
81 cerr <<
PHWHERE <<
" ERROR: Can not find DST node." << endl;
96 std::cout <<
"PairMaker::Init ended." << endl;
121 cout<<
"--------------------------- EventNumber = " <<
EventNumber-1 << endl;
127 if(!eePairs) { cerr <<
outnodename <<
" not found!" << endl; }
128 else { cout <<
"Found " <<
outnodename <<
" node." << endl; }
130 GlobalVertexMap *global_vtxmap = findNode::getClass<GlobalVertexMap>(topNode,
"GlobalVertexMap");
132 cerr <<
PHWHERE <<
" ERROR: Can not find GlobalVertexMap node." << endl;
137 SvtxVertexMap *vtxmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMap");
139 cout <<
"SvtxVertexMap node not found!" << endl;
144 SvtxTrackMap *trackmap = findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap");
146 cerr <<
PHWHERE <<
" ERROR: Can not find SvtxTrackMap node." << endl;
150 RawClusterContainer* cemc_clusters = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_CEMC");
152 cerr <<
PHWHERE <<
" ERROR: Can not find CLUSTER_CEMC node." << endl;
155 else { cout <<
"FOUND CLUSTER_CEMC node." << endl; }
169 cout <<
"Number of CEMC clusters = " << mycount << endl;
171 TrackPidAssoc *track_pid_assoc = findNode::getClass<TrackPidAssoc>(topNode,
"TrackPidAssoc");
172 if(!track_pid_assoc) {
173 cerr <<
PHWHERE <<
"ERROR: CAN NOT FIND TrackPidAssoc Node!" << endl;
186 cout <<
" Number of tracks = " << trackmap->
size() << endl;
190 cout <<
"Centrality bin = " << centbin << endl;
195 vector<sPHElectronv1> elepos;
226 for(
auto it = electrons.first;
it != electrons.second; ++
it)
232 cout <<
"CEMC match: " << cemc_clusid <<
" " << cemc_cluskey <<
" " << cemc_cluse << endl;
237 double cemc_chi2 = cluster->
get_chi2();
238 cout <<
"cluster: " << ee <<
" " << ecore <<
" " << prob <<
" " << cemc_chi2 << endl;
240 double px = track->
get_px();
241 double py = track->
get_py();
242 double pt = sqrt(px*px + py*py);
244 double x = track->
get_x();
245 double y = track->
get_y();
246 double z = track->
get_z();
247 unsigned int vtxbin = (z -
_ZMIN)/_vtxbinsize;
248 if(vtxbin<0 || vtxbin>=
NZ)
continue;
250 if(vtxid<0 || vtxid>=global_vtxmap->
size())
continue;
251 cout <<
"electron: "<<charge<<
" "<<pt<<
" "<<x<<
" "<<y<<
" "<<z<<
" "<<vtxid<<
" "<<vtxbin<< endl;
253 cout <<
"global vertex: "<<gvtx->
get_x()<<
" "<<gvtx->
get_y()<<
" "<<gvtx->
get_z()<<endl;
261 elepos.push_back(tmpel);
266 cout <<
"# of electrons/positrons = " << elepos.size() << endl;
268 if(elepos.size()>1) {
269 for(
long unsigned int i=0;
i<elepos.size()-1;
i++) {
270 for(
long unsigned int j=
i+1;
j<elepos.size();
j++) {
273 int charge1 = (elepos[
i]).get_charge();
274 int charge2 = (elepos[
j]).get_charge();
276 if(charge1*charge2<0) {type = 1;}
277 else if (charge1>0 && charge2>0) {type=2;}
278 else if (charge1<0 && charge2<0) {type=3;}
279 else {cout <<
"ERROR: wrong charge!" << endl;}
280 cout <<
"MASS = " << type <<
" " << mass << endl;
299 cout <<
"number of mixed pairs = " << nmix << endl;
310 for(
unsigned int k=0;
k<elepos.size();
k++) {
314 unsigned int vtxbin = (z -
_ZMIN)/_vtxbinsize;
315 if(vtxbin<0 || vtxbin>=
NZ)
continue;
317 unsigned int _num_mixes = 3;
321 for(
unsigned int i=0;
i<_num_mixes;
i++) {
323 unsigned int irnd = rnd * buffsize;
330 if(charge1*charge2<0) {type = 4;}
331 else if (charge1>0 && charge2>0) {type=5;}
332 else if (charge1<0 && charge2<0) {type=6;}
333 else {cout <<
"ERROR: wrong charge!" << endl;}
336 cout <<
"Inserted MIXED pair with mass = " << type <<
" " << pair.
get_mass() << endl;
354 double px = trk->
get_px();
355 double py = trk->
get_py();
356 double pz = trk->
get_pz();
357 double pt = sqrt(px*px+py*py);
358 double pp = sqrt(pt*pt+pz*pz);
360 if(pt<2.0)
return false;
361 if(pp==0.)
return false;
362 if(isnan(e3x3))
return false;
363 if(e3x3/pp<0.7)
return false;
366 if((chisq/ndf)>10.)
return false;
375 if(trackerid==0) nmvtx++;
376 if(trackerid==2) ntpc++;
378 if(nmvtx<1)
return false;
379 if(ntpc<20)
return false;
388 cout <<
"END: ====================================" << endl;
389 cout <<
"mixing buffers: " << endl;
390 for(
unsigned int i=0;
i<
NZ;
i++) {
391 for(
unsigned int j=0;
j<
NCENT;
j++) {
396 cout <<
"=========================================" << endl;