/[PAMELA software]/calo/flight/CaloEnergy/inc/CaloEnergy.h
ViewVC logotype

Diff of /calo/flight/CaloEnergy/inc/CaloEnergy.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by mocchiut, Mon Jul 13 16:10:22 2009 UTC revision 1.4 by mocchiut, Wed Jul 29 12:58:26 2009 UTC
# Line 16  Line 16 
16  #include <TSystemFile.h>  #include <TSystemFile.h>
17  #include <TSystemDirectory.h>  #include <TSystemDirectory.h>
18  #include <TSQLServer.h>  #include <TSQLServer.h>
19    #include <CaloPreSampler.h>
20    
21  #include <iostream>  #include <iostream>
22    
# Line 29  class CaloEnergy : public TObject { Line 30  class CaloEnergy : public TObject {
30   private:   private:
31      //      //
32      PamLevel2 *L2;      PamLevel2 *L2;
33      Bool_t debug;      Bool_t debug; ///< debug flag
34      //      //
35      // needed to avoid reprocessing the same event over and over to obtain the variables      // needed to avoid reprocessing the same event over and over to obtain the variables
36      //      //
37      UInt_t OBT;      UInt_t OBT; ///< CPU OBT
38      UInt_t PKT;      UInt_t PKT; ///< CPU packet number
39      UInt_t atime;      UInt_t atime; ///< event absolute time
40      TString sntr;      TString sntr; ///< string containing the list of section the user want to process
41      UInt_t AOBT;      UInt_t AOBT; ///< CPU OBT
42      UInt_t APKT;      UInt_t APKT; ///< CPU packet number
43      UInt_t aatime;      UInt_t aatime;///< event absolute time
44      TString asntr;      TString asntr;///< string containing the list of section the user want to process
45      //      //
46      Float_t fM;      Float_t fM; ///< margin in the strip direction
47      Float_t fM1;      Float_t fM1; ///< margin along the strip reading direction
48      Int_t fPl;      Int_t fPl; ///< number of dE/dx measurements over the maximum that are used to find the energy
49      Float_t fConv_rxe;      Float_t fConv_rxe; ///< MIP - energy conversion factor for section XE
50      Float_t fConv_rxo;      Float_t fConv_rxo; ///< MIP - energy conversion factor for section XO
51      Float_t fConv_rye;      Float_t fConv_rye; ///< MIP - energy conversion factor for section YE
52      Float_t fConv_ryo;      Float_t fConv_ryo; ///< MIP - energy conversion factor for section YO
53      Bool_t fLong;      Bool_t fLong; ///< if true use the integral of the longitudinal profile to measure the energy (NOT IMPLEMENTED YET), default FALSE
54      //      //
55      Float_t fEnergyxe;      Float_t fEnergyxe; ///< Energy as measured by section XE
56      Float_t fEnergyxo;      Float_t fEnergyxo; ///< Energy as measured by section XO
57      Float_t fEnergyye;      Float_t fEnergyye; ///< Energy as measured by section YE
58      Float_t fEnergyyo;      Float_t fEnergyyo; ///< Energy as measured by section YO
59      Float_t fEnergy;      Float_t fEnergy; ///< Energy as measured by the average of the used section in "Independent mode" or energy as measured by the used section in "Coherent mode"
60      Float_t fCount;      Float_t fCount; ///< Number of sections inside the acceptance (only the section given by the user are checked)
61      Int_t fMax_planexe;      Int_t fMax_planexe; ///< plane of maximum energy release (independent mode) or last plane used for energy measurement (coherent mode) for section XE
62      Int_t fMax_planexo;      Int_t fMax_planexo; ///< plane of maximum energy release (independent mode) or last plane used for energy measurement (coherent mode) for section XO
63      Int_t fMax_planeyo;      Int_t fMax_planeyo; ///< plane of maximum energy release (independent mode) or last plane used for energy measurement (coherent mode) for section YO
64      Int_t fMax_planeye;      Int_t fMax_planeye; ///< plane of maximum energy release (independent mode) or last plane used for energy measurement (coherent mode) for section YE
65      Float_t fMax_plane;      Float_t fMax_plane; ///< average max plane [0,11] (independent mode) or last plane for energy measurement [0,43] (coherent mode)
66      //      //
67      Float_t xe1;      Float_t fXOen_maxplane; ///< total energy [MIP] used for energy determination as given by section XO
68      Float_t xe2;      Float_t fYOen_maxplane; ///< total energy [MIP] used for energy determination as given by section YO
69      Float_t xe3;      Float_t fXEen_maxplane; ///< total energy [MIP] used for energy determination as given by section XE
70      Float_t xe4;      Float_t fYEen_maxplane; ///< total energy [MIP] used for energy determination as given by section YE
71      Float_t xe5;      //
72      Float_t xe6;      Float_t xe1; ///< position of strip  1 section XE
73      Float_t z1;      Float_t xe2; ///< position of strip 32 section XE
74      Float_t yo1;      Float_t xe3; ///< position of strip 33 section XE
75      Float_t yo2;      Float_t xe4; ///< position of strip 64 section XE
76      Float_t yo3;      Float_t xe5; ///< position of strip 65 section XE
77      Float_t yo4;      Float_t xe6; ///< position of strip 96 section XE
78      Float_t yo5;      //    Float_t z1;
79      Float_t yo6;      Float_t yo1; ///< position of strip  1 section YO
80      Float_t z2;      Float_t yo2; ///< position of strip 32 section YO
81      Float_t xo1;      Float_t yo3; ///< position of strip 33 section YO
82      Float_t xo2;      Float_t yo4; ///< position of strip 64 section YO
83      Float_t xo3;      Float_t yo5; ///< position of strip 65 section YO
84      Float_t xo4;      Float_t yo6; ///< position of strip 96 section YO
85      Float_t xo5;      //    Float_t z2;
86      Float_t xo6;      Float_t xo1; ///< position of strip  1 section XO
87      Float_t z3;      Float_t xo2; ///< position of strip 32 section XO
88      Float_t ye1;      Float_t xo3; ///< position of strip 33 section XO
89      Float_t ye2;      Float_t xo4; ///< position of strip 64 section XO
90      Float_t ye3;      Float_t xo5; ///< position of strip 65 section XO
91      Float_t ye4;      Float_t xo6; ///< position of strip 96 section XO
92      Float_t ye5;      //    Float_t z3;
93      Float_t ye6;      Float_t ye1; ///< position of strip  1 section YE
94      Float_t z4;      Float_t ye2; ///< position of strip 32 section YE
95      Float_t trk_z[22][2];        Float_t ye3; ///< position of strip 33 section YE
96      Float_t en;      Float_t ye4; ///< position of strip 64 section YE
97      Int_t view;      Float_t ye5; ///< position of strip 65 section YE
98      Int_t plane;      Float_t ye6; ///< position of strip 96 section YE
99      Int_t strip;      //    Float_t z4;
100      Int_t fRad;      Float_t trk_z[22][2]; ///< Z position of calorimeter planes
101      Float_t energyxe;      Float_t en; ///< energy [mip] for decodeestrip
102      Float_t energyyo;      Int_t view; ///< view for decodeestrip
103      Float_t energyxo;      Int_t plane; ///< plane for decodeestrip
104      Float_t energyye;      Int_t strip; ///< strip for decodeestrip
105      Float_t en_xep[11];      Int_t fRad; ///< Radius [strip] of the cylinder used to integrate the energy along the track, if negative radius is inf (the whole plane is used). Default: -1
106      Float_t en_yop[11];      Int_t fNumSec; ///< Number of sections given by the user
107      Float_t en_xop[11];      Float_t energyxe; ///< 11 planes detected energy [MIP] for section XE
108      Float_t en_yep[11];      Float_t energyyo; ///< 11 planes detected energy [MIP] for section YO
109      Float_t enstrip[2][22][96];          Float_t energyxo; ///< 11 planes detected energy [MIP] for section XO
110      //      Float_t energyye; ///< 11 planes detected energy [MIP] for section YE
111      Bool_t fXosel;      Float_t en_xep[11]; ///< detected energy [MIP] for each plane of section XE
112      Bool_t fXesel;      Float_t en_yop[11]; ///< detected energy [MIP] for each plane of section YO
113      Bool_t fYosel;          Float_t en_xop[11]; ///< detected energy [MIP] for each plane of section XO
114      Bool_t fYesel;      Float_t en_yep[11]; ///< detected energy [MIP] for each plane of section YE
115      Bool_t fSel;      Float_t enstrip[2][22][96]; ///< detected energy [MIP] for each strip of calorimeter
116      Bool_t fPartsel;      //
117      Int_t fXeout;      Bool_t fXosel; ///< true if event is contained in section XO
118      Int_t fYeout;      Bool_t fXesel; ///< true if event is contained in section XE
119      Int_t fXoout;      Bool_t fYosel; ///< true if event is contained in section YO  
120      Int_t fYoout;      Bool_t fYesel; ///< true if event is contained in section YE
121      Int_t fXomin;      Bool_t fSel; ///< true if event is contained in at least one of the given section (independet mode) or in all the given section (coherent mode)
122      Int_t fXemin;      Bool_t fPartsel; ///< true if the event is contained only up to the last plane used for energy determination (can be used in conjunction with fXXmin)
123      Int_t fYomin;      Int_t fXeout; ///< last plane [0,11] for which the trajectory is contained in section XE
124      Int_t fYemin;      Int_t fYeout; ///< last plane [0,11] for which the trajectory is contained in section YE
125      //      Int_t fXoout; ///< last plane [0,11] for which the trajectory is contained in section XO
126      Bool_t fSimu;      Int_t fYoout; ///< last plane [0,11] for which the trajectory is contained in section YO
127      void DefineGeometry();      Int_t fXomin; ///< last plane [0,11] for which the trajectory MUST be contained in section XO. Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY)
128      void Set();      Int_t fXemin; ///< last plane [0,11] for which the trajectory MUST be contained in section XE. Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY)
129        Int_t fYomin; ///< last plane [0,11] for which the trajectory MUST be contained in section YO. Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY)
130        Int_t fYemin; ///< last plane [0,11] for which the trajectory MUST be contained in section YE. Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY)
131        //
132        Bool_t fSimu; ///< true if we are using simulated data, default false
133        Bool_t indep; ///< flag to switch between INDEPENDENT or COHERENT mode, default false - COHERENT mode selected
134        //
135        CaloPreSampler *cp; ///< pointer to calopresampler object (object constructed only when invoking method UseCaloPreSampler() , default: use level2 data).
136        //
137        void DefineGeometry(); ///< called by constructors to fill geometrical variables (like xe1 etc).
138        void Set(); ///< called by contructors to define default variables
139    
140   public:   public:
141      //      //
142      CaloEnergy();      CaloEnergy(); ///< default constructor (does nothing)
143      CaloEnergy(PamLevel2 *L2);      CaloEnergy(PamLevel2 *L2); ///< constructor
144      CaloEnergy(PamLevel2 *L2, Bool_t simulation);      CaloEnergy(PamLevel2 *L2, Bool_t simulation); ///< constructor
145      ~CaloEnergy(){ Delete(); };      ~CaloEnergy(){ Delete(); }; ///< default destructor
146      //      //
147      void SetDebug(Bool_t d){ debug=d; };      void SetDebug(Bool_t d){ debug=d; }; ///< set the debug flag (verbose print-out on STDOUT), default is false
148      //      //
149      void Clear();      void Clear(); ///< clear varibles
150      void Clear(Option_t *option){Clear();};      void Clear(Option_t *option){Clear();}; ///< compatibility with TObject
151      void Delete();      void Delete(); ///< delete object
152      void Delete(Option_t *option){Delete();};      void Delete(Option_t *option){Delete();}; ///< compatibility with TObject
153      //      //
154      void Process();      void Process(); ///< Process the event
155      void Process(TString section);      void Process(TString section);  ///< Process the event for section "section"
156      void Print();      void Print(); ///< Print variables on STDOUT
157      void Print(Option_t *option){Print();};      void Print(Option_t *option){Print();}; ///< compatibility with TObject
158      //      //
159      Bool_t IsInsideAcceptance(TString section);      Bool_t IsInsideAcceptance(TString section); ///< returns true if event is inside acceptance of the given sections (all if coherent mode, at least one in independent mode)
160      Bool_t IsInsideReducedAcceptance(){return fPartsel;};      Bool_t IsInsideReducedAcceptance(){return fPartsel;}; ///< returns true if the event is inside acceptance only up to the last used plane (see fXomin etc)
161      //      //
162      Bool_t IsInsideXE(){return(IsInsideAcceptance("XE"));};      Bool_t IsInsideXE(){return(IsInsideAcceptance("XE"));};
163      Bool_t InsideXEcheck(){return fXesel;};      Bool_t InsideXEcheck(){return fXesel;};
# Line 157  class CaloEnergy : public TObject { Line 168  class CaloEnergy : public TObject {
168      Bool_t IsInsideYO(){return(IsInsideAcceptance("YO"));};      Bool_t IsInsideYO(){return(IsInsideAcceptance("YO"));};
169      Bool_t InsideYOcheck(){return fYosel;};      Bool_t InsideYOcheck(){return fYosel;};
170      //      //
171      Float_t GetEnergy(){ Process(); return fEnergy;};      Float_t GetEnergy(){ Process(); return fEnergy;}; ///< returns the energy [GV] determined for this event
172      Float_t GetEnergy(TString section){ Process(section); return fEnergy;};      Float_t GetEnergy(TString section){ Process(section); return fEnergy;}; ///< returns the energy [GV] determined for this event
173      Float_t GetCount(){ return fCount;};      Float_t GetCount(){ return fCount;}; ///< returns the number of section inside acceptance for this event (equal to the number of given section in coherent mode)
174      //      //
175      Float_t GetMaxplane(){ return fMax_plane;};      Float_t GetMaxplane(){ return fMax_plane;}; ///< returns the average max plane [0,11] (independent mode) or last plane for energy measurement [0,43] (coherent mode)    
176      Float_t GetMaxEnergy(TString section){ return(this->GetEnergy(section)*this->GetConversionFactor(section));};      //
177      Int_t GetMaxplane(TString section);      Float_t GetMaxEnergy(){ return((fXEen_maxplane+fYOen_maxplane+fYEen_maxplane+fXOen_maxplane));}; ///< returns the total energy [MIP] before conversion
178      //      Float_t GetMaxEnergy(TString section); ///< returns the total energy [MIP] before conversion for section "section"
179      void UseLongitudinalFitEnergy(){ fPl = 0; fLong = true;};      Int_t GetMaxplane(TString section); ///< returns the plane of maximum (independent mode) or the last used plane (coherent mode) for section "section"
180      void UseMeasuredEnergyUpToMax(){ fLong = false;};      //
181      void SetMargin(Float_t margin){fM = margin + 0.096; fM1 = margin - 0.122 - 0.096; if ( fM1 < 0. ) fM1 = 0.;};      void UseLongitudinalFitEnergy(){ fPl = 0; fLong = true;}; ///< use or not the longitudinal fit to determine the energy (NOT IMPLEMENTED YET)
182      void SetMarginStripDirection(Float_t margin){fM = margin + 0.096;};      void UseMeasuredEnergyUpToMax(){ fLong = false;}; ///< use the measured energy to determine the maximum (default)
183      void SetMarginStripReading(Float_t margin){fM1 = margin -0.122 - 0.096;};      //
184      void SetRadius(Int_t strip){fRad = strip;};      void SetMargin(Float_t margin){fM = margin + 0.096; fM1 = margin - 0.122 - 0.096; if ( fM1 < 0. ) fM1 = 0.;}; ///< set the margin from the border of the silicon sensor (not from the first strip), set the same margin for both the directions
185      void SetMaxPlaneOffset(Int_t noplanes){fPl = noplanes;};      void SetMarginStripDirection(Float_t margin){fM = margin + 0.096;}; ///< set the margin from the border of the silicon sensor (not from the first strip) in the strip direction
186      //      void SetMarginStripReading(Float_t margin){fM1 = margin -0.122 - 0.096;};  ///< set the margin from the border of the silicon sensor (not from the first strip) in the strip reading direction
187      void SetMinimumContainment(TString section, Int_t plane);      void SetRadius(Int_t strip){fRad = strip;}; ///< set the radius of the cylinder
188      Int_t GetMinimumContainment(TString section);      void SetMaxPlaneOffset(Int_t noplanes){fPl = noplanes;}; ///< set the number of dE/dx measurements to be used after the maximum
189      void SetConversionFactor(TString section, Float_t conv_r);      //
190      Float_t GetConversionFactor(TString section);      void SetMinimumContainment(Int_t plane); ///< set the last plane [0,11] for which the trajectory MUST be contained in all the sections. Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY)
191        void SetMinimumContainment(TString section, Int_t plane); ///< set the last plane [0,11] for which the trajectory MUST be contained in section "section". Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY)
192        Int_t GetMinimumContainment(TString section); ///< get the last plane [0,11] for which the trajectory MUST be contained in section "section".
193        //
194        void SetConversionFactor(Float_t conv_r); ///< Set the MIP-GV conversion factor for all the four sections.
195        void SetConversionFactor(TString section, Float_t conv_r); ///< Set the MIP-GV conversion factor for section "section".
196        Float_t GetConversionFactor(TString section); ///< Get the MIP-GV conversion factor for section "section".
197        //
198        void IndependentMode(){ indep = true; }; ///< Set the independent mode
199        void CoherentMode(){ indep = false; }; ///< Set the coherent mode
200        //
201        void UseCaloPreSampler(); ///< use pre-sampler routine to refit the track (level2 default fitting could be wrong, in this case we force "shower fitting" in the DV library).
202        CaloPreSampler* GetCaloPreSampler(){return cp;}; ///< Get pre-sampler object.
203      //      //
204      ClassDef(CaloEnergy,1);      ClassDef(CaloEnergy,1);
205  };  };

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.23