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 // 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/Vector/ThreeVector.h>
39 #include <CLHEP/Vector/LorentzVector.h>
40 #include <CLHEP/Random/Randomize.h>
41 // #include <fstream>
42 
43 // ----------------------------------------------------------------
44 // Includes needed for Root ntupling
45 //
46 #include "TROOT.h"
47 #include "TFile.h"
48 #include "TH1.h"
49 #include "TH2.h"
50 #include "TProfile.h"
51 #include "TNtuple.h"
52 #include "TRandom.h"
53 #include "TLorentzVector.h"
54 #include "TUnixSystem.h"
55 #include "TSystem.h"
56 #include "TMath.h"
57 #include "TF1.h"
58 
59 #include <TObjArray.h>
60 #include <TObjString.h>
61 #include <TNamed.h>
62 
63 class BscAnalysisHistManager : public TNamed {
64 public:
65  BscAnalysisHistManager(const TString& managername);
66  ~BscAnalysisHistManager() override;
67 
68  TH1F* GetHisto(Int_t Number);
69  TH1F* GetHisto(const TObjString& histname);
70 
71  TH2F* GetHisto2(Int_t Number);
72  TH2F* GetHisto2(const TObjString& histname);
73 
74  void WriteToFile(const TString& fOutputFile, const TString& fRecreateFile);
75 
76 private:
77  void BookHistos();
78  void StoreWeights();
79  void HistInit(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup);
80  void HistInit(
81  const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup);
82 
83  const char* fTypeTitle;
84  TObjArray* fHistArray;
85  TObjArray* fHistNamesArray;
86 };
87 
88 class BscNumberingScheme;
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<BscG4Hit> 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 BscTest: public SimProducer,
158 class BscTest : 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 public:
168  BscTest(const edm::ParameterSet& p);
169  ~BscTest() override;
170  //MyActions();
171  //MyActions();
172 private:
173  // observer classes
174  void update(const BeginOfJob* run) override;
175  void update(const BeginOfRun* run) override;
176  void update(const EndOfRun* run) override;
177  void update(const BeginOfEvent* evt) override;
178  void update(const BeginOfTrack* trk) override;
179  void update(const G4Step* step) override;
180  void update(const EndOfTrack* trk) override;
181  void update(const EndOfEvent* evt) override;
182 
183 private:
184  //UHB_Analysis* UserNtuples;
186 
187  int iev;
188  int itrk;
189  G4double entot0, tracklength0;
190 
191 private:
192  // Utilities to get detector levels during a step
193 
194  int detLevels(const G4VTouchable*) const;
195  G4String detName(const G4VTouchable*, int, int) const;
196  void detectorLevel(const G4VTouchable*, int&, int*, G4String*) const;
197 
198  double rinCalo, zinCalo;
201 
202  // SumEnerDeposit - all deposited energy on all steps ; SumStepl - length in steel !!!
204  // numofpart - # particles produced along primary track
206  // last point of the primary track
207  G4ThreeVector lastpo;
208 
209  // z:
210  double z1, z2, z3, z4;
211 
212 private:
213  Float_t bsceventarray[1];
214  TNtuple* bsceventntuple;
217 
218  BscAnalysisHistManager* TheHistManager; //Histogram Manager of the analysis
219  std::string fDataLabel; // Data type label
220  std::string fOutputFile; // The output file name
221  std::string fRecreateFile; // Recreate the file flag, default="RECREATE"
222 
223  // // // // // // TObjString fHistType;
224  // TString fDataLabel; // Data type label
225  // TString fOutputFile; // The output file name
226  // TString fRecreateFile; // Recreate the file flag, default="RECREATE"
227 };
228 
229 #endif
BscTest::SumStepc
G4double SumStepc
Definition: BscTest.h:203
BscG4Hit.h
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
Observer
Definition: Observer.h:23
BscTest::rinCalo
double rinCalo
Definition: BscTest.h:198
BscTest::TheHistManager
BscAnalysisHistManager * TheHistManager
Definition: BscTest.h:218
BscTest::z2
double z2
Definition: BscTest.h:210
BscAnalysisHistManager::WriteToFile
void WriteToFile(const TString &fOutputFile, const TString &fRecreateFile)
Definition: BscTest.cc:143
ESHandle.h
BeginOfJob.h
step
step
Definition: StallMonitor.cc:94
BscNumberingScheme
Definition: BscNumberingScheme.h:13
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BscAnalysisHistManager::fTypeTitle
const char * fTypeTitle
Definition: BscTest.h:83
EndOfTrack.h
HcalTBWriter_cfi.Number
Number
Definition: HcalTBWriter_cfi.py:19
EndOfEvent.h
EDAnalyzer.h
BscTest::entot0
G4double entot0
Definition: BscTest.h:189
BscTest::verbosity
int verbosity
Definition: BscTest.h:200
BscTest::detectorLevel
void detectorLevel(const G4VTouchable *, int &, int *, G4String *) const
Definition: BscTest.cc:499
BscTest::bscOutputFile
TFile bscOutputFile
Definition: BscTest.h:215
EndOfTrack
Definition: EndOfTrack.h:6
BscAnalysisHistManager::~BscAnalysisHistManager
~BscAnalysisHistManager() override
Definition: BscTest.cc:117
Observer.h
BeginOfTrack.h
BscTest::itrk
int itrk
Definition: BscTest.h:188
MakerMacros.h
BeginOfRun.h
SimWatcher.h
BscAnalysisHistManager::BookHistos
void BookHistos()
Definition: BscTest.cc:132
BscTest::tracklength0
G4double tracklength0
Definition: BscTest.h:189
BscTest::lastpo
G4ThreeVector lastpo
Definition: BscTest.h:207
BeginOfTrack
Definition: BeginOfTrack.h:6
BscTest::SumStepl
G4double SumStepl
Definition: BscTest.h:203
BeginOfJob
Definition: BeginOfJob.h:8
BscTest::iev
int iev
Definition: BscTest.h:187
EndOfEvent
Definition: EndOfEvent.h:6
BscAnalysisHistManager::GetHisto2
TH2F * GetHisto2(Int_t Number)
Definition: BscTest.cc:200
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
BscTest::BscTest
BscTest(const edm::ParameterSet &p)
Definition: BscTest.cc:49
BscTest::whichevent
int whichevent
Definition: BscTest.h:216
BscTest::fDataLabel
std::string fDataLabel
Definition: BscTest.h:219
BeginOfEvent.h
BscAnalysisHistManager::fHistArray
TObjArray * fHistArray
Definition: BscTest.h:84
BscTest::SumEnerDeposit
G4double SumEnerDeposit
Definition: BscTest.h:203
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:213
BscTest::lastTrackID
int lastTrackID
Definition: BscTest.h:199
BscAnalysisHistManager::BscAnalysisHistManager
BscAnalysisHistManager(const TString &managername)
Definition: BscTest.cc:103
BscTest::z1
double z1
Definition: BscTest.h:210
BeginOfEvent
Definition: BeginOfEvent.h:6
BeginOfRun
Definition: BeginOfRun.h:6
EndOfRun
Definition: EndOfRun.h:6
SimWatcher
Definition: SimWatcher.h:27
BscAnalysisHistManager
Definition: BscTest.h:63
BscTest::detLevels
int detLevels(const G4VTouchable *) const
Definition: BscTest.cc:480
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:185
Frameworkfwd.h
BscTest::fOutputFile
std::string fOutputFile
Definition: BscTest.h:220
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:198
BscTest::fRecreateFile
std::string fRecreateFile
Definition: BscTest.h:221
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BscTest
Definition: BscTest.h:158
ParameterSet.h
BscTest::~BscTest
~BscTest() override
Definition: BscTest.cc:75
BscAnalysisHistManager::fHistNamesArray
TObjArray * fHistNamesArray
Definition: BscTest.h:85
BscTest::bsceventntuple
TNtuple * bsceventntuple
Definition: BscTest.h:214
BscTest::z3
double z3
Definition: BscTest.h:210
BscTest::z4
double z4
Definition: BscTest.h:210
BscTest::numofpart
int numofpart
Definition: BscTest.h:205