]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDDigit.cxx
minor bug fixes
[u/mrichter/AliRoot.git] / FMD / AliFMDDigit.cxx
1 /**************************************************************************
2  * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 /* $Id$ */
16 /** @file    AliFMDDigit.cxx
17     @author  Christian Holm Christensen <cholm@nbi.dk>
18     @date    Mon Mar 27 12:37:41 2006
19     @brief   Digits for the FMD 
20 */
21 //////////////////////////////////////////////////////////////////////
22 //
23 //  Digits classes for the FMD                
24 //
25 //  Digits consists of
26 //   - Detector #
27 //   - Ring ID                                             
28 //   - Sector #     
29 //   - Strip #
30 //   - ADC count in this channel                                  
31 //
32 //  Digits consists of
33 //   - Detector #
34 //   - Ring ID                                             
35 //   - Sector #     
36 //   - Strip #
37 //   - Total energy deposited in the strip
38 //   - ADC count in this channel                                  
39 //
40 // As the Digits and SDigits have so much in common, the classes
41 // AliFMDDigit and AliFMDSDigit are implemented via a base
42 // class AliFMDBaseDigit.
43 ///
44 //              +-----------------+
45 //              | AliFMDBaseDigit |
46 //              +-----------------+
47 //                      ^
48 //                      |
49 //                +------------+
50 //                |            |
51 //      +-------------+ +--------------+
52 //      | AliFMDDigit | | AliFMDSDigit |
53 //      +-------------+ +--------------+
54 //
55 // (Note, that I'd really would have liked to implement AliFMDHit as a
56 // derived class from some base class - say AliFMDStrip, and the Digit
57 // classes would (eventually) have derived from that as well.
58 // However, ROOT doesn't do well with multiple inheritance, so I chose
59 // not to anyway).
60 //
61 // Latest changes by Christian Holm Christensen
62 //
63 //////////////////////////////////////////////////////////////////////
64
65 #include "AliFMDDigit.h"        // ALIFMDDIGIT_H
66 #include "Riostream.h"          // ROOT_Riostream
67 #include <TString.h>
68
69 //====================================================================
70 ClassImp(AliFMDDigit)
71 #if 0
72 ; // Here to make Emacs happy
73 #endif
74
75 //____________________________________________________________________
76 AliFMDDigit::AliFMDDigit()
77   : AliFMDBaseDigit(),
78     fCount1(0),
79     fCount2(-1),
80     fCount3(-1),
81     fCount4(-1)
82 {
83   // CTOR
84 }
85
86 //____________________________________________________________________
87 AliFMDDigit::AliFMDDigit(UShort_t       detector, 
88                          Char_t         ring, 
89                          UShort_t       sector, 
90                          UShort_t       strip, 
91                          UShort_t       count1,
92                          Short_t        count2, 
93                          Short_t        count3,
94                          Short_t        count4, 
95                          UShort_t       nrefs,
96                          const Int_t*   refs)
97   : AliFMDBaseDigit(detector, ring, sector, strip), 
98     fCount1(count1),
99     fCount2(count2),
100     fCount3(count3), 
101     fCount4(count4)
102 {
103   //
104   // Creates a real data digit object
105   //
106   // Parameters 
107   //
108   //    detector  Detector # (1, 2, or 3)                      
109   //    ring      Ring ID ('I' or 'O')
110   //    sector    Sector # (For inner/outer rings: 0-19/0-39)
111   //    strip     Strip # (For inner/outer rings: 0-511/0-255)
112   //    count1    ADC count (a 10-bit word)
113   //    count2    ADC count (a 10-bit word) -1 if not used
114   //    count3    ADC count (a 10-bit word) -1 if not used
115   if (!refs) return;
116   for (Int_t i = 0; i < nrefs; i++) AddTrack(refs[i]);
117 }
118
119 //____________________________________________________________________
120 const char*
121 AliFMDDigit::GetTitle() const 
122
123   // Get the title 
124   static TString t;
125   t = Form("ADC: %d", Counts());
126   return t.Data();
127 }
128
129 //____________________________________________________________________
130 void
131 AliFMDDigit::Print(Option_t* option) const 
132 {
133   // Print digit to standard out 
134   AliFMDBaseDigit::Print();
135   std::cout << "\t" 
136             << std::setw(4) << fCount1 << " (" 
137             << std::setw(4) << fCount2 << "," 
138             << std::setw(4) << fCount3 << "," 
139             << std::setw(4) << fCount4 << ") = " 
140             << std::setw(4) << Counts() << std::flush;
141   TString opt(option);
142   if (opt.Contains("l", TString::kIgnoreCase)) {
143     std::cout << " ";
144     for (Int_t i = 0; i < 3; i++) 
145       std::cout << (i == 0 ? "" : ",") << std::setw(5) << fTracks[i];
146   }
147   std::cout << std::endl;
148 }
149
150 //____________________________________________________________________
151 //
152 // EOF
153 //