CosmicTag.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // \brief Definition of CosmicTag analysis object
4 //
5 // \author lockwitz@fnal.gov
6 ////////////////////////////////////////////////////////////////////////
7 
9 
10 #include <iostream>
11 #include <iomanip>
12 
13 namespace anab{
14 
15  //----------------------------------------------------------------------
17  : endPt1(0)
18  , endPt2(0)
19  , fCosmicScore(0)
20  , fCosmicType(CosmicTagID_t::kUnknown)
21  {
22  }
23 
24  //----------------------------------------------------------------------
26  endPt1(0),
27  endPt2(0),
28  fCosmicScore(f),
30  {
31 
32  }
33 
34  //----------------------------------------------------------------------
35  CosmicTag::CosmicTag(std::vector<float> ePt1,
36  std::vector<float> ePt2,
37  // double flashTime, // should go
38  float cScore,
39  CosmicTagID_t cType) :
40  endPt1(ePt1),
41  endPt2(ePt2),
42  fCosmicScore(cScore),
43  fCosmicType(cType)
44  {
45  }
46 
47 
48 
49  //----------------------------------------------------------------------
50  // ostream operator.
51  //
52  std::ostream& operator<< (std::ostream & o, CosmicTag const& a)
53  {
54  o //<< "Flash Time : " << a.flashTime // should go
55  << "\n Cosmic Score : " << a.fCosmicScore
56  << "\n Cosmic Type : " << a.fCosmicType
57  << "\n End Point 1: " <<std::endl;
58  for(size_t i=0;i<a.endPt1.size(); i++)
59  o << a.endPt1[i] << ", ";
60  o << std::endl;
61  o << "\n End Point 2: " <<std::endl;
62  for(size_t i=0;i<a.endPt2.size(); i++)
63  o << a.endPt2[i] << ", ";
64  o << std::endl;
65 
66 
67  return o;
68  }
69 
70  float CosmicTag::getXInteraction(float oldX, float xDrift, int tSample,
71  float realTime, int tick ) const {
72  // fix this
73  int t =3*tSample;
74  if( (tick > 0*tSample) && (tick < 1*tSample) ) t = 0*tSample;
75  if( (tick > 1*tSample) && (tick < 2*tSample) ) t = 1*tSample;
76  if( (tick > 2*tSample) && (tick < 3*tSample) ) t = 2*tSample;
77 
78  float newX = oldX + (xDrift/tSample)*(t - realTime);
79  return newX;
80  }
81 
82 
83 }
friend std::ostream & operator<<(std::ostream &o, CosmicTag const &a)
Definition: CosmicTag.cxx:52
enum anab::cosmic_tag_id CosmicTagID_t
std::vector< float > endPt1
Definition: CosmicTag.h:43
const double a
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:75
std::vector< float > endPt2
Definition: CosmicTag.h:44
float getXInteraction(float oldX, float xDrift, int tSample, float realTime, int tick) const
Definition: CosmicTag.cxx:70
float fCosmicScore
Definition: CosmicTag.h:45
CosmicTagID_t fCosmicType
Definition: CosmicTag.h:48
QTextStream & endl(QTextStream &s)