CMS 3D CMS Logo

BscTest.h
Go to the documentation of this file.
1 #ifndef BscTest_H
2 #define BscTest_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 //
16 //
26 //#include "SimG4Core/Watcher/interface/SimProducer.h"
27 //#include "SimG4Core/Watcher/interface/SimWatcherMaker.h"
29 
31 
32 #include "G4VTouchable.hh"
33 #include <map>
34 #include <cmath>
35 #include <CLHEP/Vector/ThreeVector.h>
36 #include <CLHEP/Vector/LorentzVector.h>
37 #include <CLHEP/Random/Randomize.h>
38 // #include <fstream>
39 
40 // ----------------------------------------------------------------
41 // Includes needed for Root ntupling
42 //
43 #include "TROOT.h"
44 #include "TFile.h"
45 #include "TH1.h"
46 #include "TH2.h"
47 #include "TProfile.h"
48 #include "TNtuple.h"
49 #include "TRandom.h"
50 #include "TLorentzVector.h"
51 #include "TUnixSystem.h"
52 #include "TSystem.h"
53 #include "TMath.h"
54 #include "TF1.h"
55 
56 #include <TObjArray.h>
57 #include <TObjString.h>
58 #include <TNamed.h>
59 
60 class BscAnalysisHistManager : public TNamed {
61 public:
62  BscAnalysisHistManager(const TString& managername);
63  ~BscAnalysisHistManager() override;
64 
65  TH1F* GetHisto(Int_t Number);
66  TH1F* GetHisto(const TObjString& histname);
67 
68  TH2F* GetHisto2(Int_t Number);
69  TH2F* GetHisto2(const TObjString& histname);
70 
71  void WriteToFile(const TString& fOutputFile, const TString& fRecreateFile);
72 
73 private:
74  void BookHistos();
75  void StoreWeights();
76  void HistInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup);
77  void HistInit(
78  const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup);
79 
80  const char* fTypeTitle;
81  TObjArray* fHistArray;
82  TObjArray* fHistNamesArray;
83 };
84 
85 class BscNumberingScheme;
86 
87 class BeginOfJob;
88 class BeginOfRun;
89 class EndOfRun;
90 class BeginOfEvent;
91 class EndOfEvent;
92 class BeginOfTrack;
93 class EndOfTrack;
94 class G4Step;
95 
96 /*
97 class ObserveBeginOfRun : private Observer<const BeginOfRun *>
98 {
99 public:
100  ObserveBeginOfRun();
101 private:
102  void update(const BeginOfRun * run);
103 };
104 
105 class ObserveEndOfRun : private Observer<const EndOfRun *>
106 {
107 public:
108  ObserveEndOfRun();
109 private:
110  void update(const EndOfRun * run);
111 };
112 
113 class ObserveBeginOfEvent : private Observer<const BeginOfEvent *>
114 {
115 public:
116  ObserveBeginOfEvent();
117 private:
118  void update(const BeginOfEvent * evt);
119 };
120 
121 class ObserveEndOfEvent : private Observer<const EndOfEvent *>
122 {
123 public:
124  ObserveEndOfEvent();
125 private:
126  void update(const EndOfEvent * evt);
127  // std::vector<BscG4Hit> theStripHits;
128 };
129 
130 class ObserveBeginOfTrack : private Observer<const BeginOfTrack *>
131 {
132 public:
133  ObserveBeginOfTrack();
134 private:
135  void update(const BeginOfTrack * trk);
136 };
137 
138 class ObserveEndOfTrack : private Observer<const EndOfTrack *>
139 {
140 public:
141  ObserveEndOfTrack();
142 private:
143  void update(const EndOfTrack * trk);
144 };
145 
146 class ObserveStep : private Observer<const G4Step *>
147 {
148 public:
149  ObserveStep();
150 private:
151  void update(const G4Step * step);
152 };
153 */
154 //class BscTest: public SimProducer,
155 class BscTest : public SimWatcher,
156  public Observer<const BeginOfJob*>,
157  public Observer<const BeginOfRun*>,
158  public Observer<const EndOfRun*>,
159  public Observer<const BeginOfEvent*>,
160  public Observer<const BeginOfTrack*>,
161  public Observer<const G4Step*>,
162  public Observer<const EndOfTrack*>,
163  public Observer<const EndOfEvent*> {
164 public:
165  BscTest(const edm::ParameterSet& p);
166  ~BscTest() override;
167  //MyActions();
168  //MyActions();
169 private:
170  // observer classes
171  void update(const BeginOfJob* run) override;
172  void update(const BeginOfRun* run) override;
173  void update(const EndOfRun* run) override;
174  void update(const BeginOfEvent* evt) override;
175  void update(const BeginOfTrack* trk) override;
176  void update(const G4Step* step) override;
177  void update(const EndOfTrack* trk) override;
178  void update(const EndOfEvent* evt) override;
179 
180 private:
181  //UHB_Analysis* UserNtuples;
183 
184  int iev;
185  int itrk;
186  G4double entot0, tracklength0;
187 
188 private:
189  // Utilities to get detector levels during a step
190 
191  int detLevels(const G4VTouchable*) const;
192  G4String detName(const G4VTouchable*, int, int) const;
193  void detectorLevel(const G4VTouchable*, int&, int*, G4String*) const;
194 
195  double rinCalo, zinCalo;
198 
199  // SumEnerDeposit - all deposited energy on all steps ; SumStepl - length in steel !!!
201  // numofpart - # particles produced along primary track
203  // last point of the primary track
204  G4ThreeVector lastpo;
205 
206  // z:
207  double z1, z2, z3, z4;
208 
209 private:
210  Float_t bsceventarray[1];
211  TNtuple* bsceventntuple;
214 
215  BscAnalysisHistManager* TheHistManager; //Histogram Manager of the analysis
216  std::string fDataLabel; // Data type label
217  std::string fOutputFile; // The output file name
218  std::string fRecreateFile; // Recreate the file flag, default="RECREATE"
219 
220  // // // // // // TObjString fHistType;
221  // TString fDataLabel; // Data type label
222  // TString fOutputFile; // The output file name
223  // TString fRecreateFile; // Recreate the file flag, default="RECREATE"
224 };
225 
226 #endif
BscTest::SumStepc
G4double SumStepc
Definition: BscTest.h:200
BscG4Hit.h
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
Observer
Definition: Observer.h:23
BscTest::rinCalo
double rinCalo
Definition: BscTest.h:195
BscTest::TheHistManager
BscAnalysisHistManager * TheHistManager
Definition: BscTest.h:215
BscTest::z2
double z2
Definition: BscTest.h:207
BscAnalysisHistManager::WriteToFile
void WriteToFile(const TString &fOutputFile, const TString &fRecreateFile)
Definition: BscTest.cc:143
BeginOfJob.h
step
step
Definition: StallMonitor.cc:94
BscNumberingScheme
Definition: BscNumberingScheme.h:13
BscAnalysisHistManager::fTypeTitle
const char * fTypeTitle
Definition: BscTest.h:80
EndOfTrack.h
HcalTBWriter_cfi.Number
Number
Definition: HcalTBWriter_cfi.py:19
EndOfEvent.h
EDAnalyzer.h
BscTest::entot0
G4double entot0
Definition: BscTest.h:186
BscTest::verbosity
int verbosity
Definition: BscTest.h:197
BscTest::detectorLevel
void detectorLevel(const G4VTouchable *, int &, int *, G4String *) const
Definition: BscTest.cc:499
BscTest::bscOutputFile
TFile bscOutputFile
Definition: BscTest.h:212
EndOfTrack
Definition: EndOfTrack.h:6
BscAnalysisHistManager::~BscAnalysisHistManager
~BscAnalysisHistManager() override
Definition: BscTest.cc:117
Observer.h
BeginOfTrack.h
BscTest::itrk
int itrk
Definition: BscTest.h:185
MakerMacros.h
BeginOfRun.h
SimWatcher.h
BscAnalysisHistManager::BookHistos
void BookHistos()
Definition: BscTest.cc:132
BscTest::tracklength0
G4double tracklength0
Definition: BscTest.h:186
BscTest::lastpo
G4ThreeVector lastpo
Definition: BscTest.h:204
BeginOfTrack
Definition: BeginOfTrack.h:6
BscTest::SumStepl
G4double SumStepl
Definition: BscTest.h:200
BeginOfJob
Definition: BeginOfJob.h:8
BscTest::iev
int iev
Definition: BscTest.h:184
EndOfEvent
Definition: EndOfEvent.h:6
BscAnalysisHistManager::GetHisto2
TH2F * GetHisto2(Int_t Number)
Definition: BscTest.cc:200
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BscTest::BscTest
BscTest(const edm::ParameterSet &p)
Definition: BscTest.cc:49
BscTest::whichevent
int whichevent
Definition: BscTest.h:213
BscTest::fDataLabel
std::string fDataLabel
Definition: BscTest.h:216
BeginOfEvent.h
BscAnalysisHistManager::fHistArray
TObjArray * fHistArray
Definition: BscTest.h:81
BscTest::SumEnerDeposit
G4double SumEnerDeposit
Definition: BscTest.h:200
BscTest::detName
G4String detName(const G4VTouchable *, int, int) const
Definition: BscTest.cc:489
BscTest::update
void update(const BeginOfJob *run) override
This routine will be called when the appropriate signal arrives.
Definition: BscTest.cc:241
BscTest::bsceventarray
Float_t bsceventarray[1]
Definition: BscTest.h:210
BscTest::lastTrackID
int lastTrackID
Definition: BscTest.h:196
BscAnalysisHistManager::BscAnalysisHistManager
BscAnalysisHistManager(const TString &managername)
Definition: BscTest.cc:103
BscTest::z1
double z1
Definition: BscTest.h:207
BeginOfEvent
Definition: BeginOfEvent.h:6
BeginOfRun
Definition: BeginOfRun.h:6
EndOfRun
Definition: EndOfRun.h:6
SimWatcher
Definition: SimWatcher.h:27
BscAnalysisHistManager
Definition: BscTest.h:60
BscTest::detLevels
int detLevels(const G4VTouchable *) const
Definition: BscTest.cc:480
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EndOfRun.h
BscAnalysisHistManager::GetHisto
TH1F * GetHisto(Int_t Number)
Definition: BscTest.cc:184
writedatasetfile.run
run
Definition: writedatasetfile.py:27
BscTest::theBscNumberingScheme
BscNumberingScheme * theBscNumberingScheme
Definition: BscTest.h:182
Frameworkfwd.h
BscTest::fOutputFile
std::string fOutputFile
Definition: BscTest.h:217
BscAnalysisHistManager::HistInit
void HistInit(const char *name, const char *title, Int_t nbinsx, Axis_t xlow, Axis_t xup)
Definition: BscTest.cc:157
BscAnalysisHistManager::StoreWeights
void StoreWeights()
Definition: BscTest.cc:232
BscTest::zinCalo
double zinCalo
Definition: BscTest.h:195
BscTest::fRecreateFile
std::string fRecreateFile
Definition: BscTest.h:218
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BscTest
Definition: BscTest.h:155
ParameterSet.h
BscTest::~BscTest
~BscTest() override
Definition: BscTest.cc:75
BscAnalysisHistManager::fHistNamesArray
TObjArray * fHistNamesArray
Definition: BscTest.h:82
BscTest::bsceventntuple
TNtuple * bsceventntuple
Definition: BscTest.h:211
BscTest::z3
double z3
Definition: BscTest.h:207
BscTest::z4
double z4
Definition: BscTest.h:207
BscTest::numofpart
int numofpart
Definition: BscTest.h:202