00001
00002
00003
00004
00005
00007
00008 #ifndef sim_h
00009 #define sim_h
00010
00011 #include <TROOT.h>
00012 #include <TChain.h>
00013 #include <TFile.h>
00014 const Int_t kMaxshower = 1;
00015 const Int_t kMaxparticle_ = 100000;
00016 const Int_t kMaxlong = 10000;
00017 const Int_t kMaxcerenkov = 1;
00018
00019 class sim {
00020 public :
00021 TTree *fChain;
00022 Int_t fCurrent;
00023
00024
00025
00026 UInt_t shower_TObject_fUniqueID;
00027 UInt_t shower_TObject_fBits;
00028 Int_t shower_EventID;
00029 Float_t shower_Energy;
00030 Float_t shower_StartingAltitude;
00031 Int_t shower_FirstTarget;
00032 Float_t shower_FirstHeight;
00033 Float_t shower_Theta;
00034 Float_t shower_Phi;
00035 Int_t shower_RandomSeed[10];
00036 Int_t shower_RandomOffset[10];
00037 Float_t shower_nPhotons;
00038 Float_t shower_nElectrons;
00039 Float_t shower_nHadrons;
00040 Float_t shower_nMuons;
00041 Int_t shower_nParticlesWritten;
00042 Int_t shower_nPhotonsWritten;
00043 Int_t shower_nElectronsWritten;
00044 Int_t shower_nHadronsWritten;
00045 Int_t shower_nMuonsWritten;
00046 Float_t shower_GH_Nmax;
00047 Float_t shower_GH_t0;
00048 Float_t shower_GH_tmax;
00049 Float_t shower_GH_a;
00050 Float_t shower_GH_b;
00051 Float_t shower_GH_c;
00052 Float_t shower_GH_Chi2;
00053 Int_t shower_nPreshower;
00054 Int_t shower_CPUtime;
00055 Int_t particle__;
00056 UInt_t particle__fUniqueID[kMaxparticle_];
00057 UInt_t particle__fBits[kMaxparticle_];
00058 Int_t particle__ParticleID[kMaxparticle_];
00059 Int_t particle__ObservationLevel[kMaxparticle_];
00060 Int_t particle__HadronicGeneration[kMaxparticle_];
00061 Double_t particle__Px[kMaxparticle_];
00062 Double_t particle__Py[kMaxparticle_];
00063 Double_t particle__Pz[kMaxparticle_];
00064 Double_t particle__x[kMaxparticle_];
00065 Double_t particle__y[kMaxparticle_];
00066 Double_t particle__Time[kMaxparticle_];
00067 Double_t particle__Weight[kMaxparticle_];
00068 Int_t long_;
00069 UInt_t long_fUniqueID[kMaxlong];
00070 UInt_t long_fBits[kMaxlong];
00071 Float_t long_Depth[kMaxlong];
00072 ULong64_t long_nGammas[kMaxlong];
00073 ULong64_t long_nElectrons[kMaxlong];
00074 ULong64_t long_nPositrons[kMaxlong];
00075 ULong64_t long_nMuons[kMaxlong];
00076 ULong64_t long_nAntiMuons[kMaxlong];
00077 ULong64_t long_nHadrons[kMaxlong];
00078 ULong64_t long_nCharged[kMaxlong];
00079 ULong64_t long_nNuclei[kMaxlong];
00080 ULong64_t long_nCerenkov[kMaxlong];
00081 Int_t cerenkov_;
00082 UInt_t cerenkov_fUniqueID[kMaxcerenkov];
00083 UInt_t cerenkov_fBits[kMaxcerenkov];
00084 Float_t cerenkov_nPhotons[kMaxcerenkov];
00085 Float_t cerenkov_x[kMaxcerenkov];
00086 Float_t cerenkov_y[kMaxcerenkov];
00087 Float_t cerenkov_u[kMaxcerenkov];
00088 Float_t cerenkov_v[kMaxcerenkov];
00089 Float_t cerenkov_Time[kMaxcerenkov];
00090 Float_t cerenkov_ProductionHeight[kMaxcerenkov];
00091 Float_t cerenkov_Weight[kMaxcerenkov];
00092
00093
00094 TBranch *b_shower_TObject_fUniqueID;
00095 TBranch *b_shower_TObject_fBits;
00096 TBranch *b_shower_EventID;
00097 TBranch *b_shower_Energy;
00098 TBranch *b_shower_StartingAltitude;
00099 TBranch *b_shower_FirstTarget;
00100 TBranch *b_shower_FirstHeight;
00101 TBranch *b_shower_Theta;
00102 TBranch *b_shower_Phi;
00103 TBranch *b_shower_RandomSeed;
00104 TBranch *b_shower_RandomOffset;
00105 TBranch *b_shower_nPhotons;
00106 TBranch *b_shower_nElectrons;
00107 TBranch *b_shower_nHadrons;
00108 TBranch *b_shower_nMuons;
00109 TBranch *b_shower_nParticlesWritten;
00110 TBranch *b_shower_nPhotonsWritten;
00111 TBranch *b_shower_nElectronsWritten;
00112 TBranch *b_shower_nHadronsWritten;
00113 TBranch *b_shower_nMuonsWritten;
00114 TBranch *b_shower_GH_Nmax;
00115 TBranch *b_shower_GH_t0;
00116 TBranch *b_shower_GH_tmax;
00117 TBranch *b_shower_GH_a;
00118 TBranch *b_shower_GH_b;
00119 TBranch *b_shower_GH_c;
00120 TBranch *b_shower_GH_Chi2;
00121 TBranch *b_shower_nPreshower;
00122 TBranch *b_shower_CPUtime;
00123 TBranch *b_particle__;
00124 TBranch *b_particle__fUniqueID;
00125 TBranch *b_particle__fBits;
00126 TBranch *b_particle__ParticleID;
00127 TBranch *b_particle__ObservationLevel;
00128 TBranch *b_particle__HadronicGeneration;
00129 TBranch *b_particle__Px;
00130 TBranch *b_particle__Py;
00131 TBranch *b_particle__Pz;
00132 TBranch *b_particle__x;
00133 TBranch *b_particle__y;
00134 TBranch *b_particle__Time;
00135 TBranch *b_particle__Weight;
00136 TBranch *b_long_;
00137 TBranch *b_long_fUniqueID;
00138 TBranch *b_long_fBits;
00139 TBranch *b_long_Depth;
00140 TBranch *b_long_nGammas;
00141 TBranch *b_long_nElectrons;
00142 TBranch *b_long_nPositrons;
00143 TBranch *b_long_nMuons;
00144 TBranch *b_long_nAntiMuons;
00145 TBranch *b_long_nHadrons;
00146 TBranch *b_long_nCharged;
00147 TBranch *b_long_nNuclei;
00148 TBranch *b_long_nCerenkov;
00149 TBranch *b_cerenkov_;
00150 TBranch *b_cerenkov_fUniqueID;
00151 TBranch *b_cerenkov_fBits;
00152 TBranch *b_cerenkov_nPhotons;
00153 TBranch *b_cerenkov_x;
00154 TBranch *b_cerenkov_y;
00155 TBranch *b_cerenkov_u;
00156 TBranch *b_cerenkov_v;
00157 TBranch *b_cerenkov_Time;
00158 TBranch *b_cerenkov_ProductionHeight;
00159 TBranch *b_cerenkov_Weight;
00160
00161 sim(TTree *tree=0);
00162 virtual ~sim();
00163 virtual Int_t Cut(Long64_t entry);
00164 virtual Int_t GetEntry(Long64_t entry);
00165 virtual Long64_t LoadTree(Long64_t entry);
00166 virtual void Init(TTree *tree);
00167
00168 virtual Bool_t Notify();
00169 virtual void Show(Long64_t entry = -1);
00170 };
00171
00172 #endif
00173
00174 #ifdef sim_cxx
00175 sim::sim(TTree *tree)
00176 {
00177
00178
00179 if (tree == 0) {
00180 std::cout << "sim::sim: tree = 0" << std::endl;
00181 TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("protons_150gev.root");
00182 if (!f) {
00183 f = new TFile("protons_150gev.root");
00184 }
00185 tree = (TTree*)gDirectory->Get("sim");
00186
00187 }
00188
00189 Init(tree);
00190 }
00191
00192 sim::~sim()
00193 {
00194 if (!fChain) return;
00195 delete fChain->GetCurrentFile();
00196 }
00197
00198 Int_t sim::GetEntry(Long64_t entry)
00199 {
00200
00201 if (!fChain) return 0;
00202 return fChain->GetEntry(entry);
00203 }
00204 Long64_t sim::LoadTree(Long64_t entry)
00205 {
00206
00207 std::cout << "sim::LoadTree: " << std::endl;
00208 if (fChain) std::cout << " fChain<>0" << std::endl;
00209 else std::cout << " fChain=0" << std::endl;
00210 if (!fChain) return -5;
00211 Long64_t centry = fChain->LoadTree(entry);
00212 if (centry < 0) return centry;
00213 if (fChain->IsA() != TChain::Class()) return centry;
00214 TChain *chain = (TChain*)fChain;
00215 if (chain->GetTreeNumber() != fCurrent) {
00216 fCurrent = chain->GetTreeNumber();
00217 Notify();
00218 }
00219 return centry;
00220 }
00221
00222 void sim::Init(TTree *tree)
00223 {
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233 if (!tree) return;
00234 fChain = tree;
00235 fCurrent = -1;
00236 fChain->SetMakeClass(1);
00237
00238 fChain->SetBranchAddress("shower.TObject.fUniqueID", &shower_TObject_fUniqueID, &b_shower_TObject_fUniqueID);
00239 fChain->SetBranchAddress("shower.TObject.fBits", &shower_TObject_fBits, &b_shower_TObject_fBits);
00240 fChain->SetBranchAddress("shower.EventID", &shower_EventID, &b_shower_EventID);
00241 fChain->SetBranchAddress("shower.Energy", &shower_Energy, &b_shower_Energy);
00242 fChain->SetBranchAddress("shower.StartingAltitude", &shower_StartingAltitude, &b_shower_StartingAltitude);
00243 fChain->SetBranchAddress("shower.FirstTarget", &shower_FirstTarget, &b_shower_FirstTarget);
00244 fChain->SetBranchAddress("shower.FirstHeight", &shower_FirstHeight, &b_shower_FirstHeight);
00245 fChain->SetBranchAddress("shower.Theta", &shower_Theta, &b_shower_Theta);
00246 fChain->SetBranchAddress("shower.Phi", &shower_Phi, &b_shower_Phi);
00247 fChain->SetBranchAddress("shower.RandomSeed[10]", shower_RandomSeed, &b_shower_RandomSeed);
00248 fChain->SetBranchAddress("shower.RandomOffset[10]", shower_RandomOffset, &b_shower_RandomOffset);
00249 fChain->SetBranchAddress("shower.nPhotons", &shower_nPhotons, &b_shower_nPhotons);
00250 fChain->SetBranchAddress("shower.nElectrons", &shower_nElectrons, &b_shower_nElectrons);
00251 fChain->SetBranchAddress("shower.nHadrons", &shower_nHadrons, &b_shower_nHadrons);
00252 fChain->SetBranchAddress("shower.nMuons", &shower_nMuons, &b_shower_nMuons);
00253 fChain->SetBranchAddress("shower.nParticlesWritten", &shower_nParticlesWritten, &b_shower_nParticlesWritten);
00254 fChain->SetBranchAddress("shower.nPhotonsWritten", &shower_nPhotonsWritten, &b_shower_nPhotonsWritten);
00255 fChain->SetBranchAddress("shower.nElectronsWritten", &shower_nElectronsWritten, &b_shower_nElectronsWritten);
00256 fChain->SetBranchAddress("shower.nHadronsWritten", &shower_nHadronsWritten, &b_shower_nHadronsWritten);
00257 fChain->SetBranchAddress("shower.nMuonsWritten", &shower_nMuonsWritten, &b_shower_nMuonsWritten);
00258 fChain->SetBranchAddress("shower.GH_Nmax", &shower_GH_Nmax, &b_shower_GH_Nmax);
00259 fChain->SetBranchAddress("shower.GH_t0", &shower_GH_t0, &b_shower_GH_t0);
00260 fChain->SetBranchAddress("shower.GH_tmax", &shower_GH_tmax, &b_shower_GH_tmax);
00261 fChain->SetBranchAddress("shower.GH_a", &shower_GH_a, &b_shower_GH_a);
00262 fChain->SetBranchAddress("shower.GH_b", &shower_GH_b, &b_shower_GH_b);
00263 fChain->SetBranchAddress("shower.GH_c", &shower_GH_c, &b_shower_GH_c);
00264 fChain->SetBranchAddress("shower.GH_Chi2", &shower_GH_Chi2, &b_shower_GH_Chi2);
00265 fChain->SetBranchAddress("shower.nPreshower", &shower_nPreshower, &b_shower_nPreshower);
00266 fChain->SetBranchAddress("shower.CPUtime", &shower_CPUtime, &b_shower_CPUtime);
00267 fChain->SetBranchAddress("particle.", &particle__, &b_particle__);
00268 fChain->SetBranchAddress("particle..fUniqueID", particle__fUniqueID, &b_particle__fUniqueID);
00269 fChain->SetBranchAddress("particle..fBits", particle__fBits, &b_particle__fBits);
00270 fChain->SetBranchAddress("particle..ParticleID", particle__ParticleID, &b_particle__ParticleID);
00271 fChain->SetBranchAddress("particle..ObservationLevel", particle__ObservationLevel, &b_particle__ObservationLevel);
00272 fChain->SetBranchAddress("particle..HadronicGeneration", particle__HadronicGeneration, &b_particle__HadronicGeneration);
00273 fChain->SetBranchAddress("particle..Px", particle__Px, &b_particle__Px);
00274 fChain->SetBranchAddress("particle..Py", particle__Py, &b_particle__Py);
00275 fChain->SetBranchAddress("particle..Pz", particle__Pz, &b_particle__Pz);
00276 fChain->SetBranchAddress("particle..x", particle__x, &b_particle__x);
00277 fChain->SetBranchAddress("particle..y", particle__y, &b_particle__y);
00278 fChain->SetBranchAddress("particle..Time", particle__Time, &b_particle__Time);
00279 fChain->SetBranchAddress("particle..Weight", particle__Weight, &b_particle__Weight);
00280 fChain->SetBranchAddress("long", &long_, &b_long_);
00281 fChain->SetBranchAddress("long.fUniqueID", long_fUniqueID, &b_long_fUniqueID);
00282 fChain->SetBranchAddress("long.fBits", long_fBits, &b_long_fBits);
00283 fChain->SetBranchAddress("long.Depth", long_Depth, &b_long_Depth);
00284 fChain->SetBranchAddress("long.nGammas", long_nGammas, &b_long_nGammas);
00285 fChain->SetBranchAddress("long.nElectrons", long_nElectrons, &b_long_nElectrons);
00286 fChain->SetBranchAddress("long.nPositrons", long_nPositrons, &b_long_nPositrons);
00287 fChain->SetBranchAddress("long.nMuons", long_nMuons, &b_long_nMuons);
00288 fChain->SetBranchAddress("long.nAntiMuons", long_nAntiMuons, &b_long_nAntiMuons);
00289 fChain->SetBranchAddress("long.nHadrons", long_nHadrons, &b_long_nHadrons);
00290 fChain->SetBranchAddress("long.nCharged", long_nCharged, &b_long_nCharged);
00291 fChain->SetBranchAddress("long.nNuclei", long_nNuclei, &b_long_nNuclei);
00292 fChain->SetBranchAddress("long.nCerenkov", long_nCerenkov, &b_long_nCerenkov);
00293 fChain->SetBranchAddress("cerenkov", &cerenkov_, &b_cerenkov_);
00294 fChain->SetBranchAddress("cerenkov.fUniqueID", &cerenkov_fUniqueID, &b_cerenkov_fUniqueID);
00295 fChain->SetBranchAddress("cerenkov.fBits", &cerenkov_fBits, &b_cerenkov_fBits);
00296 fChain->SetBranchAddress("cerenkov.nPhotons", &cerenkov_nPhotons, &b_cerenkov_nPhotons);
00297 fChain->SetBranchAddress("cerenkov.x", &cerenkov_x, &b_cerenkov_x);
00298 fChain->SetBranchAddress("cerenkov.y", &cerenkov_y, &b_cerenkov_y);
00299 fChain->SetBranchAddress("cerenkov.u", &cerenkov_u, &b_cerenkov_u);
00300 fChain->SetBranchAddress("cerenkov.v", &cerenkov_v, &b_cerenkov_v);
00301 fChain->SetBranchAddress("cerenkov.Time", &cerenkov_Time, &b_cerenkov_Time);
00302 fChain->SetBranchAddress("cerenkov.ProductionHeight", &cerenkov_ProductionHeight, &b_cerenkov_ProductionHeight);
00303 fChain->SetBranchAddress("cerenkov.Weight", &cerenkov_Weight, &b_cerenkov_Weight);
00304 Notify();
00305 }
00306
00307 Bool_t sim::Notify()
00308 {
00309
00310
00311
00312
00313
00314
00315 return kTRUE;
00316 }
00317
00318 void sim::Show(Long64_t entry)
00319 {
00320
00321
00322 if (!fChain) return;
00323 fChain->Show(entry);
00324 }
00325 Int_t sim::Cut(Long64_t entry)
00326 {
00327
00328
00329
00330 return 1;
00331 }
00332 #endif // #ifdef sim_cxx