File indexing completed on 2024-04-06 12:13:27
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef sim_h
0009 #define sim_h
0010
0011 #include <TROOT.h>
0012 #include <TChain.h>
0013 #include <TFile.h>
0014 const Int_t kMaxshower = 1;
0015 const Int_t kMaxparticle_ = 100000;
0016 const Int_t kMaxlong = 10000;
0017 const Int_t kMaxcerenkov = 1;
0018
0019 class sim {
0020 public:
0021 TTree *fChain;
0022 Int_t fCurrent;
0023
0024
0025
0026 UInt_t shower_TObject_fUniqueID;
0027 UInt_t shower_TObject_fBits;
0028 Int_t shower_EventID;
0029 Float_t shower_Energy;
0030 Float_t shower_StartingAltitude;
0031 Int_t shower_FirstTarget;
0032 Float_t shower_FirstHeight;
0033 Float_t shower_Theta;
0034 Float_t shower_Phi;
0035 Int_t shower_RandomSeed[10];
0036 Int_t shower_RandomOffset[10];
0037 Float_t shower_nPhotons;
0038 Float_t shower_nElectrons;
0039 Float_t shower_nHadrons;
0040 Float_t shower_nMuons;
0041 Int_t shower_nParticlesWritten;
0042 Int_t shower_nPhotonsWritten;
0043 Int_t shower_nElectronsWritten;
0044 Int_t shower_nHadronsWritten;
0045 Int_t shower_nMuonsWritten;
0046 Float_t shower_GH_Nmax;
0047 Float_t shower_GH_t0;
0048 Float_t shower_GH_tmax;
0049 Float_t shower_GH_a;
0050 Float_t shower_GH_b;
0051 Float_t shower_GH_c;
0052 Float_t shower_GH_Chi2;
0053 Int_t shower_nPreshower;
0054 Int_t shower_CPUtime;
0055 Int_t particle__;
0056 UInt_t particle__fUniqueID[kMaxparticle_];
0057 UInt_t particle__fBits[kMaxparticle_];
0058 Int_t particle__ParticleID[kMaxparticle_];
0059 Int_t particle__ObservationLevel[kMaxparticle_];
0060 Int_t particle__HadronicGeneration[kMaxparticle_];
0061 Double_t particle__Px[kMaxparticle_];
0062 Double_t particle__Py[kMaxparticle_];
0063 Double_t particle__Pz[kMaxparticle_];
0064 Double_t particle__x[kMaxparticle_];
0065 Double_t particle__y[kMaxparticle_];
0066 Double_t particle__Time[kMaxparticle_];
0067 Double_t particle__Weight[kMaxparticle_];
0068 Int_t long_;
0069 UInt_t long_fUniqueID[kMaxlong];
0070 UInt_t long_fBits[kMaxlong];
0071 Float_t long_Depth[kMaxlong];
0072 ULong64_t long_nGammas[kMaxlong];
0073 ULong64_t long_nElectrons[kMaxlong];
0074 ULong64_t long_nPositrons[kMaxlong];
0075 ULong64_t long_nMuons[kMaxlong];
0076 ULong64_t long_nAntiMuons[kMaxlong];
0077 ULong64_t long_nHadrons[kMaxlong];
0078 ULong64_t long_nCharged[kMaxlong];
0079 ULong64_t long_nNuclei[kMaxlong];
0080 ULong64_t long_nCerenkov[kMaxlong];
0081 Int_t cerenkov_;
0082 UInt_t cerenkov_fUniqueID[kMaxcerenkov];
0083 UInt_t cerenkov_fBits[kMaxcerenkov];
0084 Float_t cerenkov_nPhotons[kMaxcerenkov];
0085 Float_t cerenkov_x[kMaxcerenkov];
0086 Float_t cerenkov_y[kMaxcerenkov];
0087 Float_t cerenkov_u[kMaxcerenkov];
0088 Float_t cerenkov_v[kMaxcerenkov];
0089 Float_t cerenkov_Time[kMaxcerenkov];
0090 Float_t cerenkov_ProductionHeight[kMaxcerenkov];
0091 Float_t cerenkov_Weight[kMaxcerenkov];
0092
0093
0094 TBranch *b_shower_TObject_fUniqueID;
0095 TBranch *b_shower_TObject_fBits;
0096 TBranch *b_shower_EventID;
0097 TBranch *b_shower_Energy;
0098 TBranch *b_shower_StartingAltitude;
0099 TBranch *b_shower_FirstTarget;
0100 TBranch *b_shower_FirstHeight;
0101 TBranch *b_shower_Theta;
0102 TBranch *b_shower_Phi;
0103 TBranch *b_shower_RandomSeed;
0104 TBranch *b_shower_RandomOffset;
0105 TBranch *b_shower_nPhotons;
0106 TBranch *b_shower_nElectrons;
0107 TBranch *b_shower_nHadrons;
0108 TBranch *b_shower_nMuons;
0109 TBranch *b_shower_nParticlesWritten;
0110 TBranch *b_shower_nPhotonsWritten;
0111 TBranch *b_shower_nElectronsWritten;
0112 TBranch *b_shower_nHadronsWritten;
0113 TBranch *b_shower_nMuonsWritten;
0114 TBranch *b_shower_GH_Nmax;
0115 TBranch *b_shower_GH_t0;
0116 TBranch *b_shower_GH_tmax;
0117 TBranch *b_shower_GH_a;
0118 TBranch *b_shower_GH_b;
0119 TBranch *b_shower_GH_c;
0120 TBranch *b_shower_GH_Chi2;
0121 TBranch *b_shower_nPreshower;
0122 TBranch *b_shower_CPUtime;
0123 TBranch *b_particle__;
0124 TBranch *b_particle__fUniqueID;
0125 TBranch *b_particle__fBits;
0126 TBranch *b_particle__ParticleID;
0127 TBranch *b_particle__ObservationLevel;
0128 TBranch *b_particle__HadronicGeneration;
0129 TBranch *b_particle__Px;
0130 TBranch *b_particle__Py;
0131 TBranch *b_particle__Pz;
0132 TBranch *b_particle__x;
0133 TBranch *b_particle__y;
0134 TBranch *b_particle__Time;
0135 TBranch *b_particle__Weight;
0136 TBranch *b_long_;
0137 TBranch *b_long_fUniqueID;
0138 TBranch *b_long_fBits;
0139 TBranch *b_long_Depth;
0140 TBranch *b_long_nGammas;
0141 TBranch *b_long_nElectrons;
0142 TBranch *b_long_nPositrons;
0143 TBranch *b_long_nMuons;
0144 TBranch *b_long_nAntiMuons;
0145 TBranch *b_long_nHadrons;
0146 TBranch *b_long_nCharged;
0147 TBranch *b_long_nNuclei;
0148 TBranch *b_long_nCerenkov;
0149 TBranch *b_cerenkov_;
0150 TBranch *b_cerenkov_fUniqueID;
0151 TBranch *b_cerenkov_fBits;
0152 TBranch *b_cerenkov_nPhotons;
0153 TBranch *b_cerenkov_x;
0154 TBranch *b_cerenkov_y;
0155 TBranch *b_cerenkov_u;
0156 TBranch *b_cerenkov_v;
0157 TBranch *b_cerenkov_Time;
0158 TBranch *b_cerenkov_ProductionHeight;
0159 TBranch *b_cerenkov_Weight;
0160
0161 sim(TTree *tree = nullptr);
0162 virtual ~sim();
0163 virtual Int_t Cut(Long64_t entry);
0164 virtual Int_t GetEntry(Long64_t entry);
0165 virtual Long64_t LoadTree(Long64_t entry);
0166 virtual void Init(TTree *tree);
0167
0168 virtual Bool_t Notify();
0169 virtual void Show(Long64_t entry = -1);
0170 };
0171
0172 #endif
0173
0174 #ifdef sim_cxx
0175 inline sim::sim(TTree *tree) {
0176
0177
0178 if (tree == nullptr) {
0179 std::cout << "sim::sim: tree = 0" << std::endl;
0180 TFile *f = (TFile *)gROOT->GetListOfFiles()->FindObject("protons_150gev.root");
0181 if (!f) {
0182 f = new TFile("protons_150gev.root");
0183 }
0184 tree = (TTree *)gDirectory->Get("sim");
0185 }
0186
0187 Init(tree);
0188 }
0189
0190 inline sim::~sim() {
0191 if (!fChain)
0192 return;
0193 delete fChain->GetCurrentFile();
0194 }
0195
0196 inline Int_t sim::GetEntry(Long64_t entry) {
0197
0198 if (!fChain)
0199 return 0;
0200 return fChain->GetEntry(entry);
0201 }
0202 inline Long64_t sim::LoadTree(Long64_t entry) {
0203
0204 std::cout << "sim::LoadTree: " << std::endl;
0205 if (fChain)
0206 std::cout << " fChain<>0" << std::endl;
0207 else
0208 std::cout << " fChain=0" << std::endl;
0209 if (!fChain)
0210 return -5;
0211 Long64_t centry = fChain->LoadTree(entry);
0212 if (centry < 0)
0213 return centry;
0214 if (fChain->IsA() != TChain::Class())
0215 return centry;
0216 TChain *chain = (TChain *)fChain;
0217 if (chain->GetTreeNumber() != fCurrent) {
0218 fCurrent = chain->GetTreeNumber();
0219 Notify();
0220 }
0221 return centry;
0222 }
0223
0224 inline void sim::Init(TTree *tree) {
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234 if (!tree)
0235 return;
0236 fChain = tree;
0237 fCurrent = -1;
0238 fChain->SetMakeClass(1);
0239
0240 fChain->SetBranchAddress("shower.TObject.fUniqueID", &shower_TObject_fUniqueID, &b_shower_TObject_fUniqueID);
0241 fChain->SetBranchAddress("shower.TObject.fBits", &shower_TObject_fBits, &b_shower_TObject_fBits);
0242 fChain->SetBranchAddress("shower.EventID", &shower_EventID, &b_shower_EventID);
0243 fChain->SetBranchAddress("shower.Energy", &shower_Energy, &b_shower_Energy);
0244 fChain->SetBranchAddress("shower.StartingAltitude", &shower_StartingAltitude, &b_shower_StartingAltitude);
0245 fChain->SetBranchAddress("shower.FirstTarget", &shower_FirstTarget, &b_shower_FirstTarget);
0246 fChain->SetBranchAddress("shower.FirstHeight", &shower_FirstHeight, &b_shower_FirstHeight);
0247 fChain->SetBranchAddress("shower.Theta", &shower_Theta, &b_shower_Theta);
0248 fChain->SetBranchAddress("shower.Phi", &shower_Phi, &b_shower_Phi);
0249 fChain->SetBranchAddress("shower.RandomSeed[10]", shower_RandomSeed, &b_shower_RandomSeed);
0250 fChain->SetBranchAddress("shower.RandomOffset[10]", shower_RandomOffset, &b_shower_RandomOffset);
0251 fChain->SetBranchAddress("shower.nPhotons", &shower_nPhotons, &b_shower_nPhotons);
0252 fChain->SetBranchAddress("shower.nElectrons", &shower_nElectrons, &b_shower_nElectrons);
0253 fChain->SetBranchAddress("shower.nHadrons", &shower_nHadrons, &b_shower_nHadrons);
0254 fChain->SetBranchAddress("shower.nMuons", &shower_nMuons, &b_shower_nMuons);
0255 fChain->SetBranchAddress("shower.nParticlesWritten", &shower_nParticlesWritten, &b_shower_nParticlesWritten);
0256 fChain->SetBranchAddress("shower.nPhotonsWritten", &shower_nPhotonsWritten, &b_shower_nPhotonsWritten);
0257 fChain->SetBranchAddress("shower.nElectronsWritten", &shower_nElectronsWritten, &b_shower_nElectronsWritten);
0258 fChain->SetBranchAddress("shower.nHadronsWritten", &shower_nHadronsWritten, &b_shower_nHadronsWritten);
0259 fChain->SetBranchAddress("shower.nMuonsWritten", &shower_nMuonsWritten, &b_shower_nMuonsWritten);
0260 fChain->SetBranchAddress("shower.GH_Nmax", &shower_GH_Nmax, &b_shower_GH_Nmax);
0261 fChain->SetBranchAddress("shower.GH_t0", &shower_GH_t0, &b_shower_GH_t0);
0262 fChain->SetBranchAddress("shower.GH_tmax", &shower_GH_tmax, &b_shower_GH_tmax);
0263 fChain->SetBranchAddress("shower.GH_a", &shower_GH_a, &b_shower_GH_a);
0264 fChain->SetBranchAddress("shower.GH_b", &shower_GH_b, &b_shower_GH_b);
0265 fChain->SetBranchAddress("shower.GH_c", &shower_GH_c, &b_shower_GH_c);
0266 fChain->SetBranchAddress("shower.GH_Chi2", &shower_GH_Chi2, &b_shower_GH_Chi2);
0267 fChain->SetBranchAddress("shower.nPreshower", &shower_nPreshower, &b_shower_nPreshower);
0268 fChain->SetBranchAddress("shower.CPUtime", &shower_CPUtime, &b_shower_CPUtime);
0269 fChain->SetBranchAddress("particle.", &particle__, &b_particle__);
0270 fChain->SetBranchAddress("particle..fUniqueID", particle__fUniqueID, &b_particle__fUniqueID);
0271 fChain->SetBranchAddress("particle..fBits", particle__fBits, &b_particle__fBits);
0272 fChain->SetBranchAddress("particle..ParticleID", particle__ParticleID, &b_particle__ParticleID);
0273 fChain->SetBranchAddress("particle..ObservationLevel", particle__ObservationLevel, &b_particle__ObservationLevel);
0274 fChain->SetBranchAddress(
0275 "particle..HadronicGeneration", particle__HadronicGeneration, &b_particle__HadronicGeneration);
0276 fChain->SetBranchAddress("particle..Px", particle__Px, &b_particle__Px);
0277 fChain->SetBranchAddress("particle..Py", particle__Py, &b_particle__Py);
0278 fChain->SetBranchAddress("particle..Pz", particle__Pz, &b_particle__Pz);
0279 fChain->SetBranchAddress("particle..x", particle__x, &b_particle__x);
0280 fChain->SetBranchAddress("particle..y", particle__y, &b_particle__y);
0281 fChain->SetBranchAddress("particle..Time", particle__Time, &b_particle__Time);
0282 fChain->SetBranchAddress("particle..Weight", particle__Weight, &b_particle__Weight);
0283 fChain->SetBranchAddress("long", &long_, &b_long_);
0284 fChain->SetBranchAddress("long.fUniqueID", long_fUniqueID, &b_long_fUniqueID);
0285 fChain->SetBranchAddress("long.fBits", long_fBits, &b_long_fBits);
0286 fChain->SetBranchAddress("long.Depth", long_Depth, &b_long_Depth);
0287 fChain->SetBranchAddress("long.nGammas", long_nGammas, &b_long_nGammas);
0288 fChain->SetBranchAddress("long.nElectrons", long_nElectrons, &b_long_nElectrons);
0289 fChain->SetBranchAddress("long.nPositrons", long_nPositrons, &b_long_nPositrons);
0290 fChain->SetBranchAddress("long.nMuons", long_nMuons, &b_long_nMuons);
0291 fChain->SetBranchAddress("long.nAntiMuons", long_nAntiMuons, &b_long_nAntiMuons);
0292 fChain->SetBranchAddress("long.nHadrons", long_nHadrons, &b_long_nHadrons);
0293 fChain->SetBranchAddress("long.nCharged", long_nCharged, &b_long_nCharged);
0294 fChain->SetBranchAddress("long.nNuclei", long_nNuclei, &b_long_nNuclei);
0295 fChain->SetBranchAddress("long.nCerenkov", long_nCerenkov, &b_long_nCerenkov);
0296 fChain->SetBranchAddress("cerenkov", &cerenkov_, &b_cerenkov_);
0297 fChain->SetBranchAddress("cerenkov.fUniqueID", &cerenkov_fUniqueID, &b_cerenkov_fUniqueID);
0298 fChain->SetBranchAddress("cerenkov.fBits", &cerenkov_fBits, &b_cerenkov_fBits);
0299 fChain->SetBranchAddress("cerenkov.nPhotons", &cerenkov_nPhotons, &b_cerenkov_nPhotons);
0300 fChain->SetBranchAddress("cerenkov.x", &cerenkov_x, &b_cerenkov_x);
0301 fChain->SetBranchAddress("cerenkov.y", &cerenkov_y, &b_cerenkov_y);
0302 fChain->SetBranchAddress("cerenkov.u", &cerenkov_u, &b_cerenkov_u);
0303 fChain->SetBranchAddress("cerenkov.v", &cerenkov_v, &b_cerenkov_v);
0304 fChain->SetBranchAddress("cerenkov.Time", &cerenkov_Time, &b_cerenkov_Time);
0305 fChain->SetBranchAddress("cerenkov.ProductionHeight", &cerenkov_ProductionHeight, &b_cerenkov_ProductionHeight);
0306 fChain->SetBranchAddress("cerenkov.Weight", &cerenkov_Weight, &b_cerenkov_Weight);
0307 Notify();
0308 }
0309
0310 inline Bool_t sim::Notify() {
0311
0312
0313
0314
0315
0316
0317 return kTRUE;
0318 }
0319
0320 inline void sim::Show(Long64_t entry) {
0321
0322
0323 if (!fChain)
0324 return;
0325 fChain->Show(entry);
0326 }
0327 inline Int_t sim::Cut(Long64_t entry) {
0328
0329
0330
0331 return 1;
0332 }
0333 #endif