StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFcsCluster.cxx
1 /*****************************************************************************
2  *
3  * $Id: StFcsCluster.cxx,v 2.1 2021/01/11 20:25:37 ullrich Exp $
4  *
5  * Author: Akio Ogawa 2018
6  * ***************************************************************************
7  *
8  * Description: Implementation of StFcsCluster, a group of adjacent FCS towers
9  *
10  * ***************************************************************************
11  *
12  * $Log: StFcsCluster.cxx,v $
13  * Revision 2.1 2021/01/11 20:25:37 ullrich
14  * Initial Revision
15  *
16  *****************************************************************************/
17 #include "StFcsCluster.h"
18 
19 #include "StMessMgr.h"
20 #include "StFcsHit.h"
21 #include "StFcsPoint.h"
22 #include "StFwdTrack.h"
23 
24 static const char rcsid[] = "$Id: StFcsCluster.cxx,v 2.1 2021/01/11 20:25:37 ullrich Exp $";
25 
26 StFcsCluster::StFcsCluster(): StObject(), mFourMomentum(0.,0.,0.,0.) { /* no op */ }
27 
28 StFcsCluster::~StFcsCluster() { /* no op */ }
29 
30 void StFcsCluster::addNeighbor(StFcsCluster* neighbor) {
31  int n=nNeighbor();
32  for(int i=0; i<n; i++) if(mNeighbor[i]==neighbor) return; //already there, do nothing
33  mNeighbor.push_back(neighbor);
34 }
35 
36 void StFcsCluster::addPoint(StFcsPoint* p) {
37  mPoints.push_back(p);
38 }
39 
40 void StFcsCluster::addPoint(StFcsPoint* p1, StFcsPoint* p2) {
41  mPoints.push_back(p1);
42  mPoints.push_back(p2);
43 }
44 
45 void StFcsCluster::addTrack(StFwdTrack* p){
46  mTracks.push_back(p);
47 }
48 
49 void StFcsCluster::sortTrackByPT() {
50  std::sort(mTracks.begin(), mTracks.end(), [](StFwdTrack* a, StFwdTrack* b) {
51  return b->momentum().perp() < a->momentum().perp();
52  });
53 }
54 
55 void StFcsCluster::print(Option_t *option) const {
56  cout << Form(
57  "StFcsCluster id=%4d ctg=%1d n=%2d nNeigh=%1d nPoints=%1d loc=%7.2f %7.2f PXYZE=%7.2lf %7.2lf %7.2lf %7.2lf E=%7.2lf sigMin/max=%7.2f %7.2f Chi2=%7.2f %7.2f",
58  id(), category(), nTowers(), nNeighbor(),nPoints(),
59  x(), y(),
60  fourMomentum().px(),fourMomentum().py(),fourMomentum().pz(),fourMomentum().e(),
61  energy(), sigmaMin(), sigmaMax(), chi2Ndf1Photon(), chi2Ndf2Photon()) << endl;
62 }