StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcMatchMaker.cxx
1 
5 #include <Stiostream.h>
6 #include "StEventTypes.h"
7 #include "StMcEventTypes.hh"
8 #include "StEEmcPool/StEEmcAssociationMaker/StEEmcAssociationMaker.h"
9 #include "StEEmcMatchMaker.h"
10 
11 ClassImp(StEEmcMatchMaker)
12 
13 //_____________________________________________________________________________
14 StEEmcMatchMaker::StEEmcMatchMaker(const char *name):StMaker(name)
15 {
16 }
17 //_____________________________________________________________________________
18 StEEmcMatchMaker::~StEEmcMatchMaker()
19 {
20 }
21 //_____________________________________________________________________________
22 Int_t StEEmcMatchMaker::Init()
23 {
24  return StMaker::Init();
25 }
26 //_____________________________________________________________________________
28 {
29 #if 0
30  const TString detname[] = {"etow", "eprs", "esmdu", "esmdv"};
31  const TString part[] = {"none", "gamma", "e+", "e-", "nu",
32  "mu+", "mu-", "pi0", "pi+",
33  "pi-", "k0l", "k+", "k-",
34  "n", "p", "p-", "k0s"};
35 
36  StEEmcAssociationMaker *assoc =
37  (StEEmcAssociationMaker*)GetMaker("EEmcAssoc");
38  if(assoc) {
39 
40 // Analyze with clusters
41  for(int i = 0; i < 4; i++) {
42  cout <<"-----------------------------------------------------\n";
43  cout <<"ASSOCIATION FOR DETECTOR "<<detname[i].Data()<<endl;
44 
45 // Check TrackCluster map
46  multiEEmcTrackCluster* tMap=assoc->getTrackClusterMap(detname[i].Data());
47  if(tMap)
48  {
49  cout <<"\nTrack->Cluster Association Map\n";
50  StMcTrack* oldTrack;
51  int nTrack = 0;
52  int nCluster;
53  for(multiEEmcTrackClusterIter j=tMap->begin(); j!=tMap->end(); j++)
54  {
55  StMcTrack* track = (StMcTrack*)(*j).first;
56  if(!track) continue;
57 
58 // Skip duplicated information of track associated with multiple clusters
59  if(track != oldTrack) {
60  if(track->geantId() > 16) continue;//check particles up to k0 short
61  nTrack++;
62  cout <<"\n"<< nTrack
63  << " McTrack" << "(" <<part[track->geantId()].Data() << ")"
64  << " pt = " << track->pt()
65  << ", TReta = " <<track->pseudoRapidity() << endl;
66  nCluster = 0;
67  }
68 
69  oldTrack = (StMcTrack*)(*j).first;
70 
71  StEEmcClusterAssociation* value =
72  (StEEmcClusterAssociation*)(*j).second;
73  if(value)
74  {
75  StEmcCluster *cluster = (StEmcCluster*) value->getCluster();
76 
77  if(cluster)
78  {
79  nCluster++;
80  cout << " " << nCluster << " Cluster " << endl;
81  cout << " E=" << cluster->energy()
82  << ", eta=" << cluster->eta()
83  << ", phi=" << cluster->phi()
84  << ", FrTr=" << value->getFractionTrack()
85  << ", FrCl=" << value->getFractionCluster()<<endl;
86 
87 // Add efficiency analysis code here
88  }
89  }
90  }
91  }
92 
93 // Check ClusterTrack map
94  multiEEmcClusterTrack* cMap=assoc->getClusterTrackMap(detname[i].Data());
95  if(cMap)
96  {
97  cout <<"\nCluster->Track Association Map\n";
98  StEmcCluster *oldCluster;
99  int nCluster = 0;
100  int nTrack;
101  for(multiEEmcClusterTrackIter j=cMap->begin(); j!=cMap->end(); j++)
102  {
103  StEmcCluster *cluster = (StEmcCluster*)(*j).first;
104  if(!cluster) continue;
105 
106 // Skip duplicated information of cluster associated with multiple tracks
107  if(cluster != oldCluster) {
108  nTrack = 0;
109  nCluster++;
110  cout <<"\n"<< nCluster << " Cluster"
111  << " E=" << cluster->energy()
112  << ", eta=" << cluster->eta()
113  << ", phi="<< cluster->phi() << endl;
114  }
115 
116  oldCluster = (StEmcCluster*)(*j).first;
117 
118  StEEmcClusterAssociation* value =
119  (StEEmcClusterAssociation*)(*j).second;
120  if(value)
121  {
122  StMcTrack* track = (StMcTrack*)value->getTrack();
123  if(track)
124  {
125  nTrack++;
126  cout << " " << nTrack
127  << " McTrack" << "(" <<part[track->geantId()].Data() << ")"<<endl
128  << " pt=" << track->pt()
129  << ", TReta=" <<track->pseudoRapidity()
130  << ", FrTr = " <<value->getFractionTrack()
131  <<", FrCl = " <<value->getFractionCluster()<<endl;
132 
133 // Add efficiency analysis code here
134  }
135  }
136  }
137  }
138  }
139 // Check TrackPoint map
140  multiEEmcTrackPoint* tMap1 = assoc->getTrackPointMap();
141  if(tMap1)
142  {
143  cout <<"\n===========================================================\n";
144  cout <<"\nTrack->Point Association Map\n";
145  StMcTrack* oldTrack;
146  int nTrack = 0;
147  int nPoint;
148  for(multiEEmcTrackPointIter j=tMap1->begin(); j!=tMap1->end(); j++)
149  {
150  StMcTrack* track = (StMcTrack*)(*j).first;
151  if(!track) continue;
152 
153 // Skip duplicated information of track associated with multiple points
154  if(track != oldTrack) {
155  if(track->geantId() > 16) continue; // check particles up to k0 short
156  nTrack++;
157  cout <<"\n"<< nTrack
158  << " McTrack" << "(" <<part[track->geantId()].Data() << ")"
159  << " pt = " << track->pt()
160  << ", TReta = " <<track->pseudoRapidity() << endl;
161  nPoint = 0;
162  }
163 
164  oldTrack = (StMcTrack*)(*j).first;
165 
166  StEEmcPointAssociation* value =
167  (StEEmcPointAssociation*)(*j).second;
168  if(value)
169  {
170  StEmcPoint *point = (StEmcPoint*) value->getPoint();
171 
172  if(point)
173  {
174  nPoint++;
175  cout << " " << nPoint << " Point "
176  << " E=" << point->energy()
177  << ", Assoc.=" << value->getAssociation()
178  << ", det:";
179  for(int i = 0; i< 4; i++)
180  if (value->getAssociation(i+1) == 1)
181  cout << " " << detname[i].Data();
182  cout << endl;
183 
184 // Add efficiency analysis code here
185  }
186  }
187  }
188  }
189 
190 // Check PointTrack map
191  multiEEmcPointTrack* pMap = assoc->getPointTrackMap();
192  if(pMap)
193  {
194  cout <<"\nPoint->Track Association Map\n";
195  StEmcPoint *oldPoint;
196  int nPoint = 0;
197  int nTrack;
198  for(multiEEmcPointTrackIter j=pMap->begin(); j!=pMap->end(); j++)
199  {
200  StEmcPoint *point = (StEmcPoint*)(*j).first;
201  if(!point) continue;
202 
203  StEEmcPointAssociation* value =
204  (StEEmcPointAssociation*)(*j).second;
205 
206 // Skip duplicated information of point associated with multiple tracks
207  if(point != oldPoint) {
208  nTrack = 0;
209  nPoint++;
210  cout <<"\n"<< nPoint << " Point"
211  << " E=" << point->energy()
212  << ", Assoc.=" << value->getAssociation();
213  for(int i = 0; i< 4; i++) {
214  if (value->getAssociation(i+1) == 1)
215  cout << " det: " << detname[i].Data();
216  }
217  cout << endl;
218  }
219 
220  oldPoint = (StEmcPoint*)(*j).first;
221 
222  if(value)
223  {
224  StMcTrack* track = (StMcTrack*)value->getTrack();
225  if(track)
226  {
227  nTrack++;
228  cout << " " << nTrack
229  << " McTrack" << "(" <<part[track->geantId()].Data() << ")"
230  << " pt=" << track->pt()
231  << ", TReta=" <<track->pseudoRapidity() << endl;
232 
233 // Add efficiency analysis code here
234  }
235  }
236  }
237  }
238  }
239 #endif
240  return kStOk;
241 }
242 
243 //_____________________________________________________________________________
245 {
246  return StMaker::Finish();
247 }
248 
250 //
251 // $Id: StEEmcMatchMaker.cxx,v 1.3 2007/07/12 19:27:17 fisyak Exp $
252 // $Log: StEEmcMatchMaker.cxx,v $
253 // Revision 1.3 2007/07/12 19:27:17 fisyak
254 // Add includes for TMath for ROOT 5.16
255 //
256 // Revision 1.2 2005/06/04 23:40:36 balewski
257 // temporary disabled - it is Saturde evening - Jan
258 //
259 // Revision 1.1.1.1 2005/05/31 18:54:40 wzhang
260 // First version
261 //
262 //
multiEEmcClusterTrack * getClusterTrackMap(Int_t i)
returns multimap for association betwwen clusters and MC tracks
multiEEmcTrackCluster * getTrackClusterMap(Int_t i)
returns multimap for association betwwen MC tracks and clusters
int getAssociation() const
returns Association information between MC track and EMC point
Monte Carlo Track class All information on a simulated track is stored in this class: kinematics...
Definition: StMcTrack.hh:144
multiEEmcPointTrack * getPointTrackMap()
returns multimap for association betwwen points and MC tracks
virtual Int_t Make()
multiEEmcTrackPoint * getTrackPointMap()
returns multimap for association betwwen MC tracks and points
const StMcTrack * getTrack() const
returns pointer to the MC track
virtual Int_t Finish()
Definition: StMaker.cxx:776
Definition: Stypes.h:41
virtual Int_t Finish()