CMS 3D CMS Logo

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