CMS 3D CMS Logo

FP420Test.h
Go to the documentation of this file.
1 #ifndef FP420Test_H
2 #define FP420Test_H
3 
4 // system include files
5 #include<vector>
6 #include <iostream>
7 #include <memory>
8 #include <string>
9 //
10 // user include files
14 
15 // necessary objects:
17 
18 //
19 //
30 
32 
33 #include "G4VTouchable.hh"
34 #include <map>
35 #include <cmath>
36 #include <CLHEP/Random/Randomize.h>
37 
38 // ----------------------------------------------------------------
39 // Includes needed for Root ntupling
40 //
41 #include "TROOT.h"
42 #include "TFile.h"
43 #include "TH1.h"
44 #include "TH2.h"
45 #include "TProfile.h"
46 #include "TNtuple.h"
47 #include "TRandom.h"
48 #include "TLorentzVector.h"
49 #include "TUnixSystem.h"
50 #include "TSystem.h"
51 #include "TMath.h"
52 #include "TF1.h"
53 
54 
55 #include <TObjArray.h>
56 #include <TObjString.h>
57 #include <TNamed.h>
58 
59 
60 class Fp420AnalysisHistManager : public TNamed {
61  public:
62 
63  Fp420AnalysisHistManager(const TString& managername);
64  ~Fp420AnalysisHistManager() override;
65 
66  TH1F* GetHisto(Int_t Number);
67  TH1F* GetHisto(const TObjString& histname);
68 
69  TH2F* GetHisto2(Int_t Number);
70  TH2F* GetHisto2(const TObjString& histname);
71 
72  void WriteToFile(const TString& fOutputFile,const TString& fRecreateFile);
73 
74  private:
75 
76  void BookHistos();
77  void StoreWeights();
78  void HistInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup);
79  void HistInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup);
80 
81  const char* fTypeTitle;
82  TObjArray* fHistArray;
83  TObjArray* fHistNamesArray;
84 
85 };
86 
87 
89 
90 class BeginOfJob;
91 class BeginOfRun;
92 class EndOfRun;
93 class BeginOfEvent;
94 class EndOfEvent;
95 class BeginOfTrack;
96 class EndOfTrack;
97 class G4Step;
98 
99 /*
100 class ObserveBeginOfRun : private Observer<const BeginOfRun *>
101 {
102 public:
103  ObserveBeginOfRun();
104 private:
105  void update(const BeginOfRun * run);
106 };
107 
108 class ObserveEndOfRun : private Observer<const EndOfRun *>
109 {
110 public:
111  ObserveEndOfRun();
112 private:
113  void update(const EndOfRun * run);
114 };
115 
116 class ObserveBeginOfEvent : private Observer<const BeginOfEvent *>
117 {
118 public:
119  ObserveBeginOfEvent();
120 private:
121  void update(const BeginOfEvent * evt);
122 };
123 
124 class ObserveEndOfEvent : private Observer<const EndOfEvent *>
125 {
126 public:
127  ObserveEndOfEvent();
128 private:
129  void update(const EndOfEvent * evt);
130  // std::vector<FP420G4Hit> theStripHits;
131 };
132 
133 class ObserveBeginOfTrack : private Observer<const BeginOfTrack *>
134 {
135 public:
136  ObserveBeginOfTrack();
137 private:
138  void update(const BeginOfTrack * trk);
139 };
140 
141 class ObserveEndOfTrack : private Observer<const EndOfTrack *>
142 {
143 public:
144  ObserveEndOfTrack();
145 private:
146  void update(const EndOfTrack * trk);
147 };
148 
149 class ObserveStep : private Observer<const G4Step *>
150 {
151 public:
152  ObserveStep();
153 private:
154  void update(const G4Step * step);
155 };
156 */
157  //class FP420Test: public SimProducer,
158 class FP420Test : public SimWatcher,
159  public Observer<const BeginOfJob *>,
160  public Observer<const BeginOfRun *>,
161  public Observer<const EndOfRun *>,
162  public Observer<const BeginOfEvent *>,
163  public Observer<const BeginOfTrack *>,
164  public Observer<const G4Step *>,
165  public Observer<const EndOfTrack *>,
166  public Observer<const EndOfEvent *>
167 {
168 public:
169  FP420Test(const edm::ParameterSet &p);
170  ~FP420Test() override;
171  //MyActions();
172  //MyActions();
173 private:
174 
175  // observer classes
176  void update(const BeginOfJob * run) override;
177  void update(const BeginOfRun * run) override;
178  void update(const EndOfRun * run) override;
179  void update(const BeginOfEvent * evt) override;
180  void update(const BeginOfTrack * trk) override;
181  void update(const G4Step * step) override;
182  void update(const EndOfTrack * trk) override;
183  void update(const EndOfEvent * evt) override;
184 
185 private:
186 
187  //UHB_Analysis* UserNtuples;
188 
189  int iev;
190  int itrk;
191  G4double entot0, tracklength0;
192 
193 private:
194 // Utilities to get detector levels during a step
195 
196  int detLevels(const G4VTouchable*) const;
197  G4String detName(const G4VTouchable*, int, int) const;
198  void detectorLevel(const G4VTouchable*, int&, int*, G4String*) const;
199 
200 
201  double rinCalo, zinCalo;
204 
205  // SumEnerDeposit - all deposited energy on all steps ; SumStepl - length in steel !!!
206  G4double SumEnerDeposit, SumStepl, SumStepc;
207  // numofpart - # particles produced along primary track
209  // last point of the primary track
210  G4ThreeVector lastpo;
211 
212 
213  // z:
214  double z1, z2, z3, z4, zD2, zD3;
215  int sn0, dn0, pn0, rn0;
216  int rn00;
217  double ZSiDet, z420;
218  double ZGapLDet, ZBoundDet, ZSiStep, ZSiPlane, zinibeg;
219  double zBlade, gapBlade;
220 
221 private:
222 
223  Float_t fp420eventarray[1];
227 
228  Fp420AnalysisHistManager* TheHistManager; //Histogram Manager of the analysis
229  std::string fDataLabel; // Data type label
230  std::string fOutputFile; // The output file name
231  std::string fRecreateFile; // Recreate the file flag, default="RECREATE"
232 
233  // // // // // // TObjString fHistType;
234 // TString fDataLabel; // Data type label
235 // TString fOutputFile; // The output file name
236 // TString fRecreateFile; // Recreate the file flag, default="RECREATE"
237 
238 };
239 
240 #endif
241 
242 
243 
244 
245 
246 
247 
248 
249 
void HistInit(const char *name, const char *title, Int_t nbinsx, Axis_t xlow, Axis_t xup)
Definition: FP420Test.cc:223
G4double SumStepl
Definition: FP420Test.h:206
const char * fTypeTitle
Definition: FP420Test.h:81
int verbosity
Definition: FP420Test.h:203
TFile fp420OutputFile
Definition: FP420Test.h:225
std::string fRecreateFile
Definition: FP420Test.h:231
void WriteToFile(const TString &fOutputFile, const TString &fRecreateFile)
Definition: FP420Test.cc:207
double ZSiStep
Definition: FP420Test.h:218
G4ThreeVector lastpo
Definition: FP420Test.h:210
double ZSiDet
Definition: FP420Test.h:217
int rn00
Definition: FP420Test.h:216
std::string fOutputFile
Definition: FP420Test.h:230
Fp420AnalysisHistManager(const TString &managername)
Definition: FP420Test.cc:147
int whichevent
Definition: FP420Test.h:226
double zinCalo
Definition: FP420Test.h:201
TH2F * GetHisto2(Int_t Number)
Definition: FP420Test.cc:272
double zD3
Definition: FP420Test.h:214
int itrk
Definition: FP420Test.h:190
int lastTrackID
Definition: FP420Test.h:202
int numofpart
Definition: FP420Test.h:208
TH1F * GetHisto(Int_t Number)
Definition: FP420Test.cc:253
TObjArray * fHistArray
Definition: FP420Test.h:82
#define update(a, b)
G4double tracklength0
Definition: FP420Test.h:191
step
Fp420AnalysisHistManager * TheHistManager
Definition: FP420Test.h:228
TNtuple * fp420eventntuple
Definition: FP420Test.h:224
std::string fDataLabel
Definition: FP420Test.h:229
TObjArray * fHistNamesArray
Definition: FP420Test.h:83
~Fp420AnalysisHistManager() override
Definition: FP420Test.cc:166
double zBlade
Definition: FP420Test.h:219