StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcHitComparisons.cc
1 /**********************************************
2  *
3  * $Id: StMcHitComparisons.cc,v 2.4 2005/11/22 21:44:52 fisyak Exp $
4  *
5  * Author: Manuel Calderon de la Barca Sanchez
6  ***********************************************
7  * Description: Define the comparisons to be used
8  * in the multimaps
9  * & sorting of containers
10  *
11  ***********************************************
12  * $Log: StMcHitComparisons.cc,v $
13  * Revision 2.4 2005/11/22 21:44:52 fisyak
14  * Add compress Print for McEvent, add Ssd collections
15  *
16  * Revision 2.3 2000/06/09 19:52:07 calderon
17  * No longer use 2 different functions for SVT and TPC that do the same thing,
18  * just use one function for the base class
19  *
20  * Revision 2.2 2000/06/06 02:58:41 calderon
21  * Introduction of Calorimeter classes. Modified several classes
22  * accordingly.
23  *
24  * Revision 2.1 2000/03/07 15:09:54 calderon
25  * Initial Revision.
26  * Comparisons used for sorting the hit containers, and
27  * for ordering the hits in the multimaps.
28  *
29  *
30  **********************************************/
31 #include "StTpcHit.h"
32 #include "StSvtHit.h"
33 #include "StSsdHit.h"
34 #include "StFtpcHit.h"
35 #include "StRichHit.h"
36 
37 #include "StMcTpcHit.hh"
38 #include "StMcSvtHit.hh"
39 #include "StMcSsdHit.hh"
40 #include "StMcFtpcHit.hh"
41 #include "StMcRichHit.hh"
42 #include "StMcHitComparisons.hh"
43 bool compHit::operator()(const StHit* h1, const StHit* h2) const {
44  if (h1->position().z() != h2->position().z()) {
45  return h1->position().z() < h2->position().z();
46  }
47  else if (h1->position().y() != h2->position().y()) {
48  return h1->position().y() < h2->position().y();
49  }
50  else return h1->position().x() < h2->position().x();
51 }
52 bool compMcHit::operator()(const StMcHit* h1, const StMcHit* h2) const {
53  if (h1->position().z() != h2->position().z()) {
54  return h1->position().z() < h2->position().z();
55  }
56  else if (h1->position().y() != h2->position().y()) {
57  return h1->position().y() < h2->position().y();
58  }
59  else return h1->position().x() < h2->position().x();
60 }
61 bool compRPhi::operator()(const StThreeVectorF& p1, const StThreeVectorF& p2) const{
62  // for Ftpc comparison is btw hits in the same plane, so
63  // z coordinate is irrelevant. Use r and phi
64  float phi1, phi2;
65  if ((phi1 = p1.phi()) != (phi2 = p2.phi()))
66  return phi1 < phi2;
67  else return p1.perp() < p2.perp();
68 }
69 bool compFtpcHit::operator()(const StFtpcHit* h1, const StFtpcHit* h2) const {
70  compRPhi crp;
71  return crp(h1->position(), h2->position());
72 }
73 bool compMcFtpcHit::operator()(const StMcFtpcHit* h1, const StMcFtpcHit* h2) const {
74  compRPhi crp;
75  return crp(h1->position(), h2->position());
76 }
Definition: StHit.h:125