15 #include <trackbase_historic/SvtxVertex.h>
16 #include <trackbase_historic/SvtxVertexMap.h>
25 #include <g4vertex/GlobalVertexMap.h>
26 #include <g4vertex/GlobalVertex.h>
27 #include <calobase/RawClusterContainer.h>
28 #include <calobase/RawCluster.h>
29 #include <calobase/RawClusterv1.h>
58 cout <<
"FilterEventsUpsilon::Init started..." << endl;
97 cout <<
"FilterEventsUpsilon::Init ended." << endl;
125 _trackmap = findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap");
140 _trkrclusters = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
143 _cemc_clusters = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_CEMC");
161 double pathlength = proj[proj.size()-3];
165 double track_x = trackstate->
get_x();
166 double track_y = trackstate->
get_y();
167 double track_z = trackstate->
get_z();
168 projection.SetX(track_x);
169 projection.SetY(track_y);
170 projection.SetZ(track_z);
181 double track_eta = 99999.;
182 double track_phi = 99999.;
192 double pathlength = proj[proj.size()-3];
196 double track_x = trackstate->
get_x();
197 double track_y = trackstate->
get_y();
198 double track_z = trackstate->
get_z() - Zvtx;
199 double track_r = sqrt(track_x*track_x+track_y*track_y);
200 track_eta = asinh( track_z / track_r );
201 track_phi = atan2( track_y, track_x );
202 }
else {
return returnCluster; }
204 if(track_eta == 99999. || track_phi == 99999.) {
return returnCluster; }
205 double dist = 99999.;
209 for (iter = begin_end.first; iter != begin_end.second; ++iter)
212 if(!cluster)
continue;
214 double cemc_ecore = cluster->
get_ecore();
215 if(cemc_ecore<1.0)
continue;
216 double cemc_x = cluster->
get_x();
217 double cemc_y = cluster->
get_y();
218 double cemc_z = cluster->
get_z() - Zvtx;
219 double cemc_r = cluster->
get_r();
220 double cemc_eta = asinh( cemc_z / cemc_r );
221 double cemc_phi = atan2( cemc_y, cemc_x );
222 double tmpdist = sqrt(pow((cemc_eta-track_eta),2)+pow((cemc_phi-track_phi),2));
224 dist = tmpdist; returnCluster = cluster; dphi = fabs(cemc_phi-track_phi); deta = fabs(cemc_eta-track_eta);
229 return returnCluster;
238 bool goodevent =
false;
240 cout <<
"getting nodes..." << endl;
243 GlobalVertexMap* _global_vtxmap = findNode::getClass<GlobalVertexMap>(topNode,
"GlobalVertexMap");
252 cout <<
"Global BBC vertex Z = " << Zvtx << endl;
254 std::vector<RawCluster *> goodclusters;
255 std::vector<TrkrCluster*> vclussilicon;
256 std::vector<TrkrCluster*> vclustpc;
257 std::vector<TrkrDefs::cluskey> vcluskeysilicon;
258 std::vector<TrkrDefs::cluskey> vcluskeytpc;
259 std::vector<SvtxTrackSeed_v1*> v_svtx_trackseed;
260 std::vector<TrackSeed*> v_silicon_trackseed;
261 std::vector<TrackSeed*> v_tpc_trackseed;
263 cout <<
"Total number of tracks = " <<
_trackmap->
size() << endl;
275 double px = track->
get_px();
276 double py = track->
get_py();
277 double pz = track->
get_pz();
278 double pt = sqrt(px * px + py * py);
280 double mom = sqrt(px * px + py * py + pz * pz);
287 if(cemc_ecore/mom < 0.7)
continue;
292 if(!tmp) cout <<
"ERROR: Failed to insert a track." << endl;
294 cout <<
" Track: " << pt << endl;
297 double trackseed_silicon_pt = trackseed_silicon->
get_pt();
298 cout <<
" Silicon seed: " << trackseed_silicon <<
" " << trackseed_silicon_pt <<
" " << trackseed_silicon->
size_cluster_keys() << endl;
300 v_silicon_trackseed.push_back(tmpseedsilicon);
303 double trackseed_tpc_pt = trackseed_tpc->
get_pt();
304 cout <<
" TPC seed: " << trackseed_tpc <<
" " << trackseed_tpc_pt <<
" " << trackseed_tpc->
size_cluster_keys() << endl;
306 v_tpc_trackseed.push_back(tmpseedtpc);
313 bool foundsiliconseed =
false;
314 bool foundtpcseed =
false;
319 double tmptpcseed_pt = tmptpcseed->
get_pt();
321 double tmpsiliconseed_pt = tmpsiliconseed->
get_pt();
322 if(tmpsiliconseed_pt == trackseed_silicon_pt) {foundsiliconseed =
true; cout <<
" Found silicon seed " << tmpsiliconseed << endl;}
323 if(tmptpcseed_pt == trackseed_tpc_pt) {foundtpcseed =
true; cout <<
" Found tpc seed " << tmptpcseed << endl;}
324 if(foundsiliconseed && foundtpcseed) {
325 cout <<
" THIS IS THE ONE: " << seed <<
" " << siliconid <<
" " << tpcid << endl;
327 v_svtx_trackseed.push_back(tmpseed);
337 bool isinserted =
false;
338 for(
unsigned int i=0;
i<vclustpc.size();
i++) {
if(clus==vclustpc[
i]) {isinserted=
true;
break;}}
346 bool isinserted =
false;
347 for(
unsigned int i=0;
i<vclussilicon.size();
i++) {
if(clus==vclussilicon[
i]) {isinserted=
true;
break;}}
352 double track_x =
proj(0);
353 double track_y =
proj(1);
354 double track_z =
proj(2) - Zvtx;
355 double track_r = sqrt(track_x*track_x+track_y*track_y);
356 double track_eta = asinh( track_z / track_r );
357 double track_phi = atan2( track_y, track_x );
362 for (clusiter = begin_end.first; clusiter != begin_end.second; ++clusiter)
365 if(!cluster) { cout <<
"ERROR: bad cluster pointer = " << cluster << endl;
continue; }
367 double cemc_ecore = cluster->
get_ecore();
368 if(cemc_ecore<1.0)
continue;
369 double cemc_x = cluster->
get_x();
370 double cemc_y = cluster->
get_y();
371 double cemc_z = cluster->
get_z() - Zvtx;
372 double cemc_r = cluster->
get_r();
373 double cemc_eta = asinh( cemc_z / cemc_r );
374 double cemc_phi = atan2( cemc_y, cemc_x );
375 double dist = sqrt(pow(cemc_phi-track_phi,2)+pow(cemc_eta-track_eta,2));
377 bool isinserted =
false;
378 for(
unsigned int i=0;
i<goodclusters.size();
i++) {
if(cluster==goodclusters[
i]) {isinserted=
true;
break;}}
386 cout <<
" Number of CEMC clusters for output = " << goodclusters.size() << endl;
387 cout <<
" Number of svtx seeds for output = " << v_svtx_trackseed.size() << endl;
388 cout <<
" Number of tpc seeds for output = " << v_tpc_trackseed.size() << endl;
389 cout <<
" Number of silicon seeds for output = " << v_silicon_trackseed.size() << endl;
396 cout <<
" Number of TRKR clusters for output: " << vclussilicon.size() <<
" " << vclustpc.size() << endl;
397 cout <<
" Number of TRKR cluster keys for output: " << vcluskeysilicon.size() <<
" " << vcluskeytpc.size() << endl;
399 for(
unsigned int cl = 0; cl < vclussilicon.size(); cl++)
401 for(
unsigned int cl = 0; cl < vclustpc.size(); cl++)
407 for(
unsigned int cl = 0; cl < v_svtx_trackseed.size(); cl++)
430 cout <<
"Number of scanned events = " <<
EventNumber << endl;