StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPicoFmsHit.cxx
1 //
2 // StPicoFmsHit stores FMS hit information
3 //
4 
5 // C++ headers
6 #include <iostream>
7 #include <limits>
8 
9 // PicoDst headers
10 #include "StPicoMessMgr.h"
11 #include "StPicoFmsHit.h"
12 
13 ClassImp(StPicoFmsHit)
14 
15 //_________________
16 StPicoFmsHit::StPicoFmsHit() : TObject(), mChannelDetectorId(0), mAdc(0) {
17  /* emtpy */
18 }
19 
20 //_________________
21 StPicoFmsHit::StPicoFmsHit(Int_t detectorId, Int_t channelId, Int_t adc) : TObject() {
22  mChannelDetectorId = 32*channelId + detectorId;
23  mAdc = adc;
24 }
25 
26 //_________________
28  mChannelDetectorId = hit.mChannelDetectorId;
29  mAdc = hit.mAdc;
30 }
31 
32 //_________________
34  /* empty */
35 }
36 
37 //_________________
38 void StPicoFmsHit::Print(const Char_t *option __attribute__((unused)) ) const {
39  LOG_INFO << " FMS hit -"
40  << " detectorId: " << detectorId()
41  << " channel: " << channel()
42  << " ADC: " << adc() << endm;
43 }
44 
45 //_________________
46 void StPicoFmsHit::setAdc(Float_t adc) {
47  mAdc = ( (adc > std::numeric_limits<unsigned short>::max()) ?
48  std::numeric_limits<unsigned short>::max() : (UShort_t)adc );
49 }
50 
51 //_________________
52 void StPicoFmsHit::setAdc(Int_t adc) {
53  mAdc = ( (adc > std::numeric_limits<unsigned short>::max()) ?
54  std::numeric_limits<unsigned short>::max() : (UShort_t)adc );
55 }
56 
57 //_________________
58 void StPicoFmsHit::setChannelDetectorId(Int_t channelId, Int_t detectorId) {
59  mChannelDetectorId = ( ( (32*channelId + detectorId) > std::numeric_limits<unsigned short>::max() ) ?
60  std::numeric_limits<unsigned short>::max() : (UShort_t)(32*channelId + detectorId) );
61 }
void setChannelDetectorId(Int_t channelId, Int_t detectorId)
Set channel and detector ID.
virtual ~StPicoFmsHit()
Destructor.
Int_t channel() const
Return channel [0,2047].
Definition: StPicoFmsHit.h:38
Holds information about FMS hit.
Definition: StPicoFmsHit.h:17
virtual void Print(const Char_t *option="") const
Prints FMS hit information.
void setAdc(Float_t adc)
Set ADC.
Int_t detectorId() const
Return detector ID [0,31].
Definition: StPicoFmsHit.h:36
StPicoFmsHit()
Default constructor.
Int_t adc() const
Return ADC.
Definition: StPicoFmsHit.h:40