]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/v0/AliITSDigitUpgrade.h
Fix for ITS dictionaries
[u/mrichter/AliRoot.git] / ITS / UPGRADE / v0 / AliITSDigitUpgrade.h
1 #ifndef ALIITSDigitUpgrade_H
2 #define ALIITSDigitUpgrade_H
3 /* Copyright(c) 2004-2006, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice     */
5 /////////////////////////////////////////////////////////////
6 //              Authors A.Mastroserio                      //           
7 //                      C.Terrevoli                        // 
8 //                      annalisa.mastroserio@cern.ch       //
9 //                      cristina.terrevoli@cern.ch         //
10 //                                                         //
11 //              Digit class for ITS upgrade                //
12 //                                                         //
13 /////////////////////////////////////////////////////////////
14
15 /* $Id$ */
16
17 #include <AliDigit.h>
18 #include <TArrayI.h>
19 //______________________________________________________________________
20 class AliITSDigitUpgrade: public AliDigit {
21
22  public:
23   AliITSDigitUpgrade();
24   AliITSDigitUpgrade(Int_t *digits);
25   AliITSDigitUpgrade(ULong_t pixid, Float_t eloss);
26   AliITSDigitUpgrade(const AliITSDigitUpgrade &d); //copy ctor
27
28   virtual ~AliITSDigitUpgrade() {/*destructor*/};
29   //____________________________________________________________________________________________________
30     
31   enum {kMaxLab=12}; // maximum number of MC labels associated to the digit (4 times as much as can be stored in the "mother class")
32
33   void AddTidOffset(Int_t offset) {for(Int_t i=0; i<kMaxLab; i++) if (fTrackIdMC[i]>-1) fTrackIdMC[i]+=offset;} //needed for merging
34     
35   // setters
36        
37   void SetSignal(Float_t sig) {fSignal = sig;}
38   void SetLayer(Int_t layer) {fNLayer = layer;}
39   void SetModule(Int_t module) {fModule = module ;}
40   void SetNTracksIdMC(Int_t nLabels) {fNTracksIdMC = nLabels;}
41   void SetNelectrons(Double_t nele) {fNelectrons = nele;}
42
43
44   void SetTrackID(Int_t tid) {fTrackIdMC[0]=tid; }
45   void SetTids(Int_t tids[kMaxLab]){ for(Int_t i=0; i<kMaxLab; i++) fTrackIdMC[i]=tids[i];} // tracks participating to form the digit
46   void AddTrackID(Int_t tid); 
47   void SetPixId(ULong_t nx, ULong_t nz) {fPixId = 100000*nx + nz;}
48   void SetPixId(ULong_t pixid){fPixId = pixid;}
49
50   void SetSignalID(Float_t eloss[kMaxLab]){for(Int_t i=0; i< kMaxLab; i++) fSignalID[i]=eloss[i];}
51
52   // getters
53     
54   Float_t  GetSignal() const {return fSignal;}
55   Int_t    GetLayer() const {return fNLayer;}
56   Int_t    GetModule() const {return fModule;}
57   Double_t GetNelectrons() const {return fNelectrons;}
58   ULong_t  GetPixId(){return fPixId;}
59   Int_t    GetxPixelNumber() const {return fPixId/100000;}
60   Int_t    GetzPixelNumber() const {return fPixId%100000;}
61   Int_t    GetNTracksIdMC() const {return fNTracksIdMC;}
62   Int_t*   GetTracks() {return fTrackIdMC; }
63   Int_t    GetTrackID(Int_t ipart) const  {if(ipart<0 || ipart>=kMaxLab) return -1; else return fTrackIdMC[ipart];}
64   Float_t  GetSignalID(Int_t ipart) const {if(ipart<0 || ipart>=kMaxLab) return -1; else return fSignalID[ipart];}
65     
66   void GetPosition(Int_t ilayer, Int_t nx, Int_t nz, Double_t &xloc, Double_t &zloc);
67     
68   void PrintInfo(); 
69   inline Int_t   Compare     (const TObject *pObj)const;
70   Bool_t IsSortable() const {return kTRUE;}
71    
72  protected:
73     
74   ULong_t fPixId;    // ID number of the fired pixel in a module
75   Float_t fSignal;   // Signal as Eloss in the medium
76   Int_t fNLayer;     // Layer 
77   Int_t fModule;     // Module in the layer
78   Double_t fNelectrons; // released charge due to E loss
79   Int_t fNTracksIdMC;  // Number of MC particles which produced the Digit
80   Int_t fTrackIdMC[kMaxLab];  // MC track labels 
81   Float_t fSignalID[kMaxLab]; // E loss
82   
83
84  private:
85   AliITSDigitUpgrade &operator=(const AliITSDigitUpgrade &);    // not implemented
86
87
88   ClassDef(AliITSDigitUpgrade,3)   // Simulated digit object for ITS upgrade
89
90
91
92 };
93 #endif
94
95 Int_t AliITSDigitUpgrade::Compare(const TObject *pObj) const
96 {
97   // Arguments: pObj - pointer to object to compare with
98   //        
99
100   Int_t result = -1;
101   if (fModule>((AliITSDigitUpgrade*)pObj)->GetModule()) result=1;      
102   
103   else  if(fModule==((AliITSDigitUpgrade*)pObj)->GetModule()){
104     if     (fPixId==((AliITSDigitUpgrade*)pObj)->GetPixId()) result=0;
105     else if(fPixId >((AliITSDigitUpgrade*)pObj)->GetPixId()) result=1;
106   }
107   return result;
108
109 }
110
111