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 #include <TObjArray.h>
55 #include <TObjString.h>
56 #include <TNamed.h>
57 
58 class Fp420AnalysisHistManager : public TNamed {
59 public:
60  Fp420AnalysisHistManager(const TString& managername);
61  ~Fp420AnalysisHistManager() override;
62 
63  TH1F* GetHisto(Int_t Number);
64  TH1F* GetHisto(const TObjString& histname);
65 
66  TH2F* GetHisto2(Int_t Number);
67  TH2F* GetHisto2(const TObjString& histname);
68 
69  void WriteToFile(const TString& fOutputFile, const TString& fRecreateFile);
70 
71 private:
72  void BookHistos();
73  void StoreWeights();
74  void HistInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup);
75  void HistInit(
76  const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup);
77 
78  const char* fTypeTitle;
79  TObjArray* fHistArray;
80  TObjArray* fHistNamesArray;
81 };
82 
84 
85 class BeginOfJob;
86 class BeginOfRun;
87 class EndOfRun;
88 class BeginOfEvent;
89 class EndOfEvent;
90 class BeginOfTrack;
91 class EndOfTrack;
92 class G4Step;
93 
94 /*
95 class ObserveBeginOfRun : private Observer<const BeginOfRun *>
96 {
97 public:
98  ObserveBeginOfRun();
99 private:
100  void update(const BeginOfRun * run);
101 };
102 
103 class ObserveEndOfRun : private Observer<const EndOfRun *>
104 {
105 public:
106  ObserveEndOfRun();
107 private:
108  void update(const EndOfRun * run);
109 };
110 
111 class ObserveBeginOfEvent : private Observer<const BeginOfEvent *>
112 {
113 public:
114  ObserveBeginOfEvent();
115 private:
116  void update(const BeginOfEvent * evt);
117 };
118 
119 class ObserveEndOfEvent : private Observer<const EndOfEvent *>
120 {
121 public:
122  ObserveEndOfEvent();
123 private:
124  void update(const EndOfEvent * evt);
125  // std::vector<FP420G4Hit> theStripHits;
126 };
127 
128 class ObserveBeginOfTrack : private Observer<const BeginOfTrack *>
129 {
130 public:
131  ObserveBeginOfTrack();
132 private:
133  void update(const BeginOfTrack * trk);
134 };
135 
136 class ObserveEndOfTrack : private Observer<const EndOfTrack *>
137 {
138 public:
139  ObserveEndOfTrack();
140 private:
141  void update(const EndOfTrack * trk);
142 };
143 
144 class ObserveStep : private Observer<const G4Step *>
145 {
146 public:
147  ObserveStep();
148 private:
149  void update(const G4Step * step);
150 };
151 */
152 //class FP420Test: public SimProducer,
153 class FP420Test : public SimWatcher,
154  public Observer<const BeginOfJob*>,
155  public Observer<const BeginOfRun*>,
156  public Observer<const EndOfRun*>,
157  public Observer<const BeginOfEvent*>,
158  public Observer<const BeginOfTrack*>,
159  public Observer<const G4Step*>,
160  public Observer<const EndOfTrack*>,
161  public Observer<const EndOfEvent*> {
162 public:
163  FP420Test(const edm::ParameterSet& p);
164  ~FP420Test() override;
165  //MyActions();
166  //MyActions();
167 private:
168  // observer classes
169  void update(const BeginOfJob* run) override;
170  void update(const BeginOfRun* run) override;
171  void update(const EndOfRun* run) override;
172  void update(const BeginOfEvent* evt) override;
173  void update(const BeginOfTrack* trk) override;
174  void update(const G4Step* step) override;
175  void update(const EndOfTrack* trk) override;
176  void update(const EndOfEvent* evt) override;
177 
178 private:
179  //UHB_Analysis* UserNtuples;
180 
181  int iev;
182  int itrk;
183  G4double entot0, tracklength0;
184 
185 private:
186  // Utilities to get detector levels during a step
187 
188  int detLevels(const G4VTouchable*) const;
189  G4String detName(const G4VTouchable*, int, int) const;
190  void detectorLevel(const G4VTouchable*, int&, int*, G4String*) const;
191 
192  double rinCalo, zinCalo;
195 
196  // SumEnerDeposit - all deposited energy on all steps ; SumStepl - length in steel !!!
197  G4double SumEnerDeposit, SumStepl, SumStepc;
198  // numofpart - # particles produced along primary track
200  // last point of the primary track
201  G4ThreeVector lastpo;
202 
203  // z:
204  double z1, z2, z3, z4, zD2, zD3;
205  int sn0, dn0, pn0, rn0;
206  int rn00;
207  double ZSiDet, z420;
208  double ZGapLDet, ZBoundDet, ZSiStep, ZSiPlane, zinibeg;
209  double zBlade, gapBlade;
210 
211 private:
212  Float_t fp420eventarray[1];
216 
217  Fp420AnalysisHistManager* TheHistManager; //Histogram Manager of the analysis
218  std::string fDataLabel; // Data type label
219  std::string fOutputFile; // The output file name
220  std::string fRecreateFile; // Recreate the file flag, default="RECREATE"
221 
222  // // // // // // TObjString fHistType;
223  // TString fDataLabel; // Data type label
224  // TString fOutputFile; // The output file name
225  // TString fRecreateFile; // Recreate the file flag, default="RECREATE"
226 };
227 
228 #endif
void HistInit(const char *name, const char *title, Int_t nbinsx, Axis_t xlow, Axis_t xup)
Definition: FP420Test.cc:214
G4double SumStepl
Definition: FP420Test.h:197
const char * fTypeTitle
Definition: FP420Test.h:78
int verbosity
Definition: FP420Test.h:194
TFile fp420OutputFile
Definition: FP420Test.h:214
std::string fRecreateFile
Definition: FP420Test.h:220
void WriteToFile(const TString &fOutputFile, const TString &fRecreateFile)
Definition: FP420Test.cc:200
double ZSiStep
Definition: FP420Test.h:208
G4ThreeVector lastpo
Definition: FP420Test.h:201
double ZSiDet
Definition: FP420Test.h:207
int rn00
Definition: FP420Test.h:206
std::string fOutputFile
Definition: FP420Test.h:219
Fp420AnalysisHistManager(const TString &managername)
Definition: FP420Test.cc:144
int whichevent
Definition: FP420Test.h:215
double zinCalo
Definition: FP420Test.h:192
TH2F * GetHisto2(Int_t Number)
Definition: FP420Test.cc:257
double zD3
Definition: FP420Test.h:204
int itrk
Definition: FP420Test.h:182
int lastTrackID
Definition: FP420Test.h:193
int numofpart
Definition: FP420Test.h:199
TH1F * GetHisto(Int_t Number)
Definition: FP420Test.cc:241
TObjArray * fHistArray
Definition: FP420Test.h:79
#define update(a, b)
G4double tracklength0
Definition: FP420Test.h:183
step
Definition: StallMonitor.cc:94
Fp420AnalysisHistManager * TheHistManager
Definition: FP420Test.h:217
TNtuple * fp420eventntuple
Definition: FP420Test.h:213
std::string fDataLabel
Definition: FP420Test.h:218
TObjArray * fHistNamesArray
Definition: FP420Test.h:80
~Fp420AnalysisHistManager() override
Definition: FP420Test.cc:161
double zBlade
Definition: FP420Test.h:209