]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RALICE/AliCalorimeter.h
7083260a4a4d165329ccda531310ee4bf7e89605
[u/mrichter/AliRoot.git] / RALICE / AliCalorimeter.h
1 #ifndef ALICALORIMETER_H
2 #define ALICALORIMETER_H
3 ///////////////////////////////////////////////////////////////////////////
4 // Class AliCalorimeter
5 // Description of a modular calorimeter system.
6 // A matrix geometry is used in which a module is identified by (row,col).
7 // Note : First module is identified as (1,1).
8 //
9 // This is the way to define and enter signals into a calorimeter :
10 //
11 //   AliCalorimeter cal(10,15);  // Calorimeter of 10x15 modules
12 //                               // All module signals set to 0.
13 //   cal.AddSignal(5,7,85.4);
14 //   cal.AddSignal(5,7,25.9);
15 //   cal.AddSignal(3,5,1000);
16 //   cal.SetSignal(5,7,10.3);
17 //   cal.Reset(3,5);             // Reset module (3,5) as being 'not fired'
18 //                               // All module data are re-initialised.
19 //   cal.SetEdgeOn(1,1);         // Declare module (1,1) as an 'edge module'
20 //   cal.SetDead(8,3);
21 //   cal.SetGain(2,8,3.2);
22 //
23 //   Float_t vec[3]={6,1,20};
24 //   cal.SetPosition(2,8,vec,"car");
25 //
26 //   Float_t loc[3]={-1,12,3};
27 //   cal.AddVetoSignal(loc,"car"); // Associate (extrapolated) position as a veto
28 //
29 //   cal.Group(2);      // Group 'fired' modules into clusters
30 //                      // Perform grouping over 2 rings around the center
31 //   cal.Reset();       // Reset the complete calorimeter
32 //                      // Normally to prepare for the next event data
33 //                      // Note : Module gain, edge and dead flags remain
34 //
35 //--- NvE 13-jun-1997 UU-SAP Utrecht
36 ///////////////////////////////////////////////////////////////////////////
37  
38 #include <iostream.h>
39 #include <math.h>
40  
41 #include "TObject.h"
42 #include "TObjArray.h"
43 #include "TH2.h"
44 #include "TString.h"
45
46 #include "AliDetector.h"
47
48 #include "AliCalmodule.h"
49 #include "AliCalcluster.h"
50 #include "AliSignal.h"
51  
52 class AliCalorimeter : public AliDetector
53 {
54  public:
55   AliCalorimeter();                                // Default constructor
56   AliCalorimeter(Int_t nrow,Int_t ncol);           // Create a calorimeter matrix
57   ~AliCalorimeter();                               // Destructor
58   Int_t GetNrows();                                // Return number of rows of the matrix
59   Int_t GetNcolumns();                             // Return number of columns of the matrix
60   void SetSignal(Int_t row,Int_t col,Float_t s);   // Set signal for a certain module
61   void AddSignal(Int_t row,Int_t col,Float_t s);   // Add signal to a certain module
62   void Reset(Int_t row,Int_t col);                 // Reset signal for a certain module
63   void Reset();                                    // Reset the complete calorimeter
64   Float_t GetSignal(Int_t row,Int_t col);          // Provide signal of a certain module
65   Int_t GetNsignals();                             // Return number of modules with a signal
66   void Group(Int_t n);                             // Group modules into clusters (n rings)
67   Int_t GetNclusters();                            // Return number of clusters
68   Float_t GetClusteredSignal(Int_t row,Int_t col); // Provide module signal after clustering
69   AliCalcluster* GetCluster(Int_t j);              // Access to cluster number j
70   AliCalmodule* GetModule(Int_t j);                // Access to 'fired' module number j
71   void SetEdgeOn(Int_t row,Int_t col);             // Indicate module as 'edge module'
72   void SetEdgeOff(Int_t row,Int_t col);            // Indicate module as 'non-edge module'
73   Int_t GetEdgeValue(Int_t row,Int_t col);         // Provide the edge flag of a module
74   void SetDead(Int_t row,Int_t col);               // Indicate module as 'dead module'
75   void SetAlive(Int_t row,Int_t col);              // Indicate module as 'active module'
76   Int_t GetDeadValue(Int_t row,Int_t col);         // Provide the dead flag of a module
77   void SetGain(Int_t row,Int_t col,Float_t g);     // Set the gain value for a module
78   Float_t GetGain(Int_t row,Int_t col);            // Provide the gain value of a module
79   void SetPosition(Int_t row,Int_t col,Float_t* r,TString f); // Set module position
80   void GetPosition(Int_t row,Int_t col,Float_t* r,TString f); // Return module position
81   TH2F* DrawModules();                             // Draw lego plot of module signals
82   TH2F* DrawClusters();                            // Draw lego plot of cluster signals
83   void AddVetoSignal(Float_t* r,TString f,Float_t s=0); // Associate (extrapolated) signal
84   AliSignal* GetVetoSignal(Int_t j);               // Access to veto signal number j
85   Int_t GetNvetos();                               // Provide the number of veto signals
86  
87  protected:
88   Int_t fNrows;                              // The number of rows
89   Int_t fNcolumns;                           // The number of columns
90   Int_t fNsignals;                           // The number of modules with a signal
91   Int_t fNclusters;                          // The number of clusters
92   AliCalmodule** fMatrix;                    //! The matrix of modules for internal use
93   void Sortm(AliCalmodule*);                 // Order the modules with decreasing signal
94   TObjArray* fClusters;                      // The array of clusters
95   void AddRing(Int_t row,Int_t col,Int_t n); // add signals of n rings around cluster center
96   TObjArray* fModules;                       // The array of modules for output
97   void LoadMatrix();                         // Load calorimeter matrix data from input
98   void Ungroup();                            // Restore module matrix as before clustering
99   TH2F* fHmodules;                           //! The module 2-D histogram
100   TH2F* fHclusters;                          //! The cluster 2-D histogram
101   Int_t fNvetos;                             // The number of associated veto signals
102   TObjArray* fVetos;                         // The array of associated (extrapolated) veto signals
103  
104  ClassDef(AliCalorimeter,1) // Class definition to enable ROOT I/O
105 };
106 #endif