AliRoot Core  edcc906 (edcc906)
AliFMDMap.h
Go to the documentation of this file.
1 #ifndef ALIFMDMAP_H
2 #define ALIFMDMAP_H
3 /* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights
4  * reserved.
5  *
6  * See cxx source for full Copyright notice
7  */
8 #ifndef ROOT_TObject
9 # include <TObject.h>
10 #endif
11 class TFile;
12 
13 //____________________________________________________________________
19 class AliFMDMap : public TObject
20 {
21 public:
22  enum {
26  kMaxRings = 2,
28  kMaxSectors = 40,
30  kMaxStrips = 512
31  };
32  enum {
34  kInner = 0,
37  };
38  enum {
40  kNStripOuter = 256,
43  };
44  enum {
49  };
50  enum {
52  kBaseInner = 0,
55  };
56  enum {
58  kFMD1Base = 0,
63  };
68  class ForOne
69  {
70  public:
72  virtual ~ForOne() { }
84  virtual Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t,
85  Float_t v);
97  virtual Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t,
98  Int_t v);
110  virtual Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t,
111  UShort_t v);
123  virtual Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t,
124  Bool_t v);
125  };
130  class Printer : public ForOne
131  {
132  public:
138  Printer(const char* format);
142  virtual ~Printer() {}
148  Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t, Float_t m);
154  Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t, Int_t m);
160  Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t, UShort_t m);
166  Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t, Bool_t m);
167  private:
173  Printer(const Printer& p);
179  Printer& operator=(const Printer&) { return *this; }
188  virtual void PrintHeadings(UShort_t d, Char_t r, UShort_t s, UShort_t t);
190  const char* fFormat;
192  UShort_t fOldD;
194  Char_t fOldR;
196  UShort_t fOldS;
197  };
198 
207  AliFMDMap(UShort_t maxDet = 0,
208  UShort_t maxRing= 0,
209  UShort_t maxSec = 0,
210  UShort_t maxStr = 0);
216  AliFMDMap(const AliFMDMap& other);
218  virtual ~AliFMDMap() {}
220  UShort_t MaxDetectors() const { return fMaxDetectors==0 ? 3 :fMaxDetectors;}
222  UShort_t MaxRings() const { return fMaxRings ==0 ? 2 :fMaxRings; }
224  UShort_t MaxSectors() const { return fMaxSectors ==0 ? 40 :fMaxSectors; }
226  UShort_t MaxStrips() const { return fMaxStrips ==0 ? 512 :fMaxStrips; }
236  void CalcCoords(Int_t idx,
237  UShort_t& det,
238  Char_t& ring,
239  UShort_t& sec,
240  UShort_t& str) const;
251  Int_t CalcIndex(UShort_t det, Char_t ring,
252  UShort_t sec, UShort_t str) const;
263  Int_t CheckIndex(UShort_t det, Char_t ring,
264  UShort_t sec, UShort_t str) const;
270  void CheckNeedUShort(TFile* file);
278  AliFMDMap& operator*=(const AliFMDMap& o);
286  AliFMDMap& operator/=(const AliFMDMap& o);
294  AliFMDMap& operator+=(const AliFMDMap& o);
302  AliFMDMap& operator-=(const AliFMDMap& o);
312  virtual Bool_t ForEach(ForOne& algo) const;
319  virtual Int_t MaxIndex() const = 0;
325  virtual void Print(Option_t* option="") const;
349  virtual Float_t AtAsFloat(Int_t idx) const;
371  virtual Float_t& AtAsFloat(Int_t idx);
381  virtual Int_t AtAsInt(Int_t idx) const;
391  virtual Int_t& AtAsInt(Int_t idx);
401  virtual UShort_t AtAsUShort(Int_t idx) const;
411  virtual UShort_t& AtAsUShort(Int_t idx);
422  virtual Bool_t AtAsBool(Int_t idx) const;
433  virtual Bool_t& AtAsBool(Int_t idx);
440  virtual Bool_t IsFloat() const { return kFALSE; }
447  virtual Bool_t IsInt() const { return kFALSE; }
454  virtual Bool_t IsUShort() const { return kFALSE; }
461  virtual Bool_t IsBool() const { return kFALSE; }
467  virtual void* Ptr() const = 0;
468  enum {
471  };
472 protected:
487  Int_t Coords2Index(UShort_t det, Char_t ring,
488  UShort_t sec, UShort_t str) const;
503  Int_t Coords2IndexOld(UShort_t det, Char_t ring,
504  UShort_t sec, UShort_t str) const;
517  void Index2CoordsOld(Int_t idx,
518  UShort_t& det,
519  Char_t& ring,
520  UShort_t& sec,
521  UShort_t& str) const;
533  void Index2Coords(Int_t idx,
534  UShort_t& det,
535  Char_t& ring,
536  UShort_t& sec,
537  UShort_t& str) const;
538  UShort_t fMaxDetectors; // Maximum # of detectors
539  UShort_t fMaxRings; // Maximum # of rings
540  UShort_t fMaxSectors; // Maximum # of sectors
541  UShort_t fMaxStrips; // Maximum # of strips
542 
543  ClassDef(AliFMDMap, 4) // Cache of per strip information
544 };
545 
546 inline Float_t
548 {
549  return 0;
550 }
551 inline Float_t&
553 {
554  static Float_t d;
555  return d;
556 }
557 inline Int_t
558 AliFMDMap::AtAsInt(Int_t) const
559 {
560  return 0;
561 }
562 inline Int_t&
564 {
565  static Int_t d;
566  return d;
567 }
568 inline UShort_t
570 {
571  return 0;
572 }
573 inline UShort_t&
575 {
576  static UShort_t d;
577  return d;
578 }
579 inline Bool_t
581 {
582  return kFALSE;
583 }
584 inline Bool_t&
586 {
587  static Bool_t d;
588  return d;
589 }
590 inline Bool_t
591 AliFMDMap::ForOne::operator()(UShort_t, Char_t, UShort_t, UShort_t, Float_t)
592 {
593  return kTRUE;
594 }
595 inline Bool_t
596 AliFMDMap::ForOne::operator()(UShort_t, Char_t, UShort_t, UShort_t, Int_t)
597 {
598  return kTRUE;
599 }
600 inline Bool_t
601 AliFMDMap::ForOne::operator()(UShort_t, Char_t, UShort_t, UShort_t, UShort_t)
602 {
603  return kTRUE;
604 }
605 inline Bool_t
606 AliFMDMap::ForOne::operator()(UShort_t, Char_t, UShort_t, UShort_t, Bool_t)
607 {
608  return kTRUE;
609 }
610 
611 
612 
613 #endif
614 //____________________________________________________________________
615 //
616 // Local Variables:
617 // mode: C++
618 // End:
619 //
620 // EOF
621 //
622 
623 
UShort_t MaxStrips() const
Definition: AliFMDMap.h:226
AliFMDMap & operator-=(const AliFMDMap &o)
Definition: AliFMDMap.cxx:318
virtual ~AliFMDMap()
Definition: AliFMDMap.h:218
Printer & operator=(const Printer &)
Definition: AliFMDMap.h:179
virtual Bool_t AtAsBool(Int_t idx) const
Definition: AliFMDMap.h:580
UShort_t fMaxStrips
Definition: AliFMDMap.h:541
Int_t CheckIndex(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
Definition: AliFMDMap.cxx:178
virtual Int_t AtAsInt(Int_t idx) const
Definition: AliFMDMap.h:558
const char * fFormat
Definition: AliFMDMap.h:190
virtual void Print(Option_t *option="") const
Definition: AliFMDMap.cxx:362
UShort_t fMaxSectors
Definition: AliFMDMap.h:540
Float_t p[]
Definition: kNNTest.C:133
virtual Float_t AtAsFloat(Int_t idx) const
Definition: AliFMDMap.h:547
AliFMDMap & operator*=(const AliFMDMap &o)
Definition: AliFMDMap.cxx:267
virtual ~ForOne()
Definition: AliFMDMap.h:72
virtual ~Printer()
Definition: AliFMDMap.h:142
virtual Bool_t IsBool() const
Definition: AliFMDMap.h:461
UShort_t fMaxDetectors
Definition: AliFMDMap.h:538
AliFMDMap(UShort_t maxDet=0, UShort_t maxRing=0, UShort_t maxSec=0, UShort_t maxStr=0)
Definition: AliFMDMap.cxx:41
Base class for caches of per-strip information.This is used to index a strip. Data stored depends on ...
Definition: AliFMDMap.h:19
Int_t Coords2IndexOld(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
Definition: AliFMDMap.cxx:134
void CheckNeedUShort(TFile *file)
Definition: AliFMDMap.cxx:73
void Index2Coords(Int_t idx, UShort_t &det, Char_t &ring, UShort_t &sec, UShort_t &str) const
Definition: AliFMDMap.cxx:99
virtual Bool_t IsUShort() const
Definition: AliFMDMap.h:454
virtual Bool_t IsInt() const
Definition: AliFMDMap.h:447
void Index2CoordsOld(Int_t idx, UShort_t &det, Char_t &ring, UShort_t &sec, UShort_t &str) const
Definition: AliFMDMap.cxx:83
UShort_t MaxRings() const
Definition: AliFMDMap.h:222
UShort_t MaxDetectors() const
Definition: AliFMDMap.h:220
virtual Bool_t ForEach(ForOne &algo) const
Definition: AliFMDMap.cxx:335
virtual Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t, Float_t v)
Definition: AliFMDMap.h:591
virtual UShort_t AtAsUShort(Int_t idx) const
Definition: AliFMDMap.h:569
AliFMDMap & operator/=(const AliFMDMap &o)
Definition: AliFMDMap.cxx:284
UShort_t MaxSectors() const
Definition: AliFMDMap.h:224
Int_t Coords2Index(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
Definition: AliFMDMap.cxx:151
virtual Bool_t IsFloat() const
Definition: AliFMDMap.h:440
AliFMDMap & operator+=(const AliFMDMap &o)
Definition: AliFMDMap.cxx:301
void CalcCoords(Int_t idx, UShort_t &det, Char_t &ring, UShort_t &sec, UShort_t &str) const
Definition: AliFMDMap.cxx:118
Int_t CalcIndex(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
Definition: AliFMDMap.cxx:192
UShort_t fMaxRings
Definition: AliFMDMap.h:539
virtual void * Ptr() const =0
virtual Int_t MaxIndex() const =0