File indexing completed on 2024-04-06 12:32:18
0001 #define Loopers_cxx
0002 #include "Loopers.h"
0003 #include <TH2.h>
0004 #include <TStyle.h>
0005 #include <TCanvas.h>
0006
0007 #include <cmath>
0008
0009
0010
0011
0012
0013 void Loopers::Loop()
0014 {
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 if (fChain == 0) return;
0039
0040 Long64_t nentries = fChain->GetEntriesFast();
0041
0042 theLogFile << " Entries " << nentries << endl;
0043
0044 Long64_t nbytes = 0, nb = 0;
0045 for (Long64_t jentry=0; jentry<nentries; jentry++) {
0046
0047 Long64_t ientry = LoadTree(jentry);
0048 if (ientry < 0) break;
0049 nb = fChain->GetEntry(jentry); nbytes += nb;
0050
0051
0052 double phiSum = 1e-11;
0053 double phi_init = 0.0;
0054 double phi_last = 0.0;
0055 unsigned int n_loops = 0;
0056
0057 double pathSum = 1e-11;
0058 double normDensSum = 0.0;
0059 double pathSum_211 = 0.0;
0060 double pathSum_13 = 0.0;
0061 double pathSum_11 = 0.0;
0062 double pathSum_2212 = 0.0;
0063
0064 double nuclSum = 1e-11;
0065
0066 unsigned int iHadronicInteractions = 0;
0067 double energyLossHad = 0.0;
0068
0069 int iParticle = -1;
0070 double particleMass = -1;
0071
0072
0073
0074 theLogFile << "Event " << jentry+1 << " Steps = " << Nsteps << endl;
0075 Int_t lastStep = 0;
0076 for(Int_t iStep=0; iStep<Nsteps; iStep++) {
0077
0078
0079 double x_i = sqrt(
0080 (FinalX[iStep]-InitialX[iStep]) * (FinalX[iStep]-InitialX[iStep])
0081 +
0082 (FinalY[iStep]-InitialY[iStep]) * (FinalY[iStep]-InitialY[iStep])
0083 +
0084 (FinalZ[iStep]-InitialZ[iStep]) * (FinalZ[iStep]-InitialZ[iStep])
0085 );
0086
0087
0088 if(ParticleStepPostInteraction[iStep] == 4) {
0089 iHadronicInteractions++;
0090 energyLossHad += (InitialE[iStep] - FinalE[iStep]);
0091 }
0092
0093
0094 if(iStep==0) actualParticleID = ParticleStepID[iStep];
0095 if(iStep!=0) {
0096 if(FinalZ[iStep-1] != InitialZ[iStep]) {
0097 theLogFile << "\t\t EMISSION at " << iStep
0098 << " from " << actualParticleID << " of a " << ParticleStepID[iStep] << endl;
0099 }
0100 }
0101
0102
0103 if(actualParticleID != ParticleStepID[iStep]) {
0104 theLogFile << "\t\t DECAY at " << iStep
0105 << " from " << actualParticleID << " to " << ParticleStepID[iStep] << endl;
0106 actualParticleID = ParticleStepID[iStep];
0107 if (fabs(ParticleStepID[iStep]) == 211) {
0108 iParticle = 1;
0109 }
0110 if (fabs(ParticleStepID[iStep]) == 13) {
0111 iParticle = 2;
0112 }
0113 if (fabs(ParticleStepID[iStep]) == 11) {
0114 iParticle = 3;
0115 }
0116 if (fabs(ParticleStepID[iStep]) == 2212) {
0117 iParticle = 4;
0118 }
0119 hist_productionEnergy_vs_secondaryParticle->Fill((float)iParticle,(InitialE[iStep]-InitialM[iStep]));
0120 }
0121
0122
0123 if (fabs(ParticleStepID[iStep]) == 211) {
0124 pathSum_211+=x_i;
0125 }
0126 if (fabs(ParticleStepID[iStep]) == 13) {
0127 pathSum_13+=x_i;
0128 }
0129 if (fabs(ParticleStepID[iStep]) == 11) {
0130 pathSum_11+=x_i;
0131 }
0132 if (fabs(ParticleStepID[iStep]) == 2212) {
0133 pathSum_2212+=x_i;
0134 }
0135
0136
0137
0138 if( fabs(ParticleStepID[iStep])!=211
0139 &&
0140 fabs(ParticleStepID[iStep])!=13
0141 &&
0142 fabs(ParticleStepID[iStep])!=11
0143 &&
0144 fabs(ParticleStepID[iStep])!=2212
0145 ) {
0146
0147 continue;
0148 } else {
0149
0150 }
0151
0152
0153 if( ( ParticleStepID[0] == ParticleID )
0154 &&
0155 (
0156 ( (FinalE[iStep]-InitialM[iStep]) < Ekin_threshold )
0157 ||
0158 ( ParticleStepPostInteraction[iStep] == 6 )
0159 )
0160 ) {
0161 if(lastStep == 0) {
0162 theLogFile << "Set final step to " << iStep << " final E " << FinalE[iStep] << " MeV" << endl;
0163 lastStep = iStep;
0164 }
0165 continue;
0166 }
0167
0168
0169
0170 double xStep = (FinalX[iStep]+InitialX[iStep])/2;
0171 double yStep = (FinalY[iStep]+InitialY[iStep])/2;
0172 double zStep = (FinalZ[iStep]+InitialZ[iStep])/2;
0173
0174 double phi_i = atan2(yStep,xStep);
0175 double deltaPhi = (phi_last > 0 && phi_i < 0) ? (phi_i-phi_last)+(2*pi) : phi_i-phi_last;
0176 phiSum += deltaPhi;
0177
0178
0179
0180 double rho_i = MaterialDensity[iStep];
0181 pathSum += x_i;
0182 normDensSum += (rho_i * x_i);
0183
0184 double l0_i = MaterialLambda0[iStep];
0185 nuclSum += (x_i / l0_i);
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197 phi_last = phi_i;
0198
0199 }
0200
0201 double phiTurns = phiSum/(2*pi);
0202 phiTurns += (float)n_loops;
0203
0204 theLogFile << " Last Step = " << lastStep << endl;
0205 if(lastStep!=0) {
0206
0207 double averageDensity = normDensSum / pathSum;
0208 double averageLambda0 = pathSum / nuclSum;
0209 double time = (pathSum/1000.) / c;
0210 double bunchCrossings = (time * 1E9) / bx;
0211
0212 if(
0213 (
0214 ParticleStepFinalPt[lastStep] > 10
0215 &&
0216 FinalZ[lastStep] < 2500
0217 )
0218 ||
0219 (
0220 ParticleStepPostInteraction[lastStep] == 0
0221 )
0222 ) {
0223 theLogFile << "################################" << endl;
0224 theLogFile << "Event " << jentry+1 << endl;
0225 theLogFile << "\t Steps = " << Nsteps << endl;
0226 theLogFile << "\t Last Step = " << lastStep << endl;
0227 theLogFile << "\t Sum(phi_i) = " << phiSum << endl;
0228 theLogFile << "\t Turns = " << phiTurns << endl;
0229 theLogFile << "\t Energy Init = " << InitialE[0] << endl;
0230 theLogFile << "\t Energy End = " << FinalE[lastStep] << endl;
0231 theLogFile << "\t Final Z = " << FinalZ[lastStep] << endl;
0232 theLogFile << "\t Particle Mass = " << InitialM[0] << endl;
0233 theLogFile << "\t pT Init = " << ParticleStepInitialPt[0] << endl;
0234 theLogFile << "\t pT End = " << ParticleStepFinalPt[lastStep] << endl;
0235 theLogFile << "\t Last particle = " << ParticleStepID[lastStep] << endl;
0236 theLogFile << "\t Final Pre Interaction = " << ParticleStepPreInteraction[lastStep] << endl;
0237 theLogFile << "\t Final Post Interaction = " << ParticleStepPostInteraction[lastStep] << endl;
0238 theLogFile << "\t Sum(x_i) = " << pathSum << " mm" << endl;
0239 theLogFile << "\t Sum(x_i x rho_i) = " << normDensSum << " mm x g/cm3" << endl;
0240 theLogFile << "\t <rho> = " << averageDensity << " g/cm3" << endl;
0241 theLogFile << "\t <lambda0> = " << averageLambda0 << " mm" << endl;
0242 theLogFile << "\t path length per turn = " << pathSum / phiTurns << " mm" << endl;
0243 theLogFile << "\t time spent = " << time << " s" << endl;
0244 theLogFile << "\t bunch crossings = " << bunchCrossings << endl;
0245 theLogFile << "################################" << endl;
0246 }
0247
0248 hist_loops->Fill(phiTurns);
0249 hist_energy_init->Fill(InitialE[0]);
0250 hist_energy_end->Fill(FinalE[lastStep]);
0251 hist_energy_beforeend->Fill(InitialE[lastStep]);
0252 hist_density->Fill(averageDensity);
0253 hist_lambda0->Fill(averageLambda0);
0254 hist_density_vs_loops->Fill(phiTurns,averageDensity);
0255 hist_pT_init->Fill(ParticleStepInitialPt[0]);
0256 hist_pT_end->Fill(ParticleStepFinalPt[lastStep]);
0257 hist_energyLossPerTurn->Fill( (InitialE[0]-FinalE[lastStep]) / phiTurns );
0258 hist_trackLength->Fill(pathSum);
0259 hist_trackLengthPerTurn->Fill(pathSum / phiTurns);
0260 hist_lastInteraction->Fill(ParticleStepPostInteraction[lastStep]);
0261 hist_bx->Fill(bunchCrossings);
0262 hist_bx_finer->Fill(bunchCrossings);
0263 hist_energybeforeend_vs_lastInteraction->Fill(ParticleStepPostInteraction[lastStep],InitialE[lastStep]);
0264 hist_trackLength_vs_lastInteraction->Fill(ParticleStepPostInteraction[lastStep],pathSum);
0265 hist_hadronicInteractions->Fill((float)iHadronicInteractions);
0266 hist_hadronicInteractions_vs_lastInteraction->Fill(ParticleStepPostInteraction[lastStep],(float)iHadronicInteractions);
0267 hist_energyLossHadronicInteractions->Fill(energyLossHad);
0268
0269
0270
0271
0272
0273 if( !(pathSum_11 > 0) ) pathSum_11 = -10000.;
0274 if( !(pathSum_2212 > 0) ) pathSum_2212 = -10000.;
0275
0276 if(pathSum_13 > 0){
0277 hist_bx_vs_secondaryParticle->Fill(1,-10.);
0278 hist_bx_vs_secondaryParticle->Fill(2,((pathSum_211+pathSum_13)/1000)/c*1E9/bx);
0279 } else {
0280 hist_bx_vs_secondaryParticle->Fill(1,(pathSum_211/1000)/c*1E9/bx);
0281 hist_bx_vs_secondaryParticle->Fill(2,-10.);
0282 }
0283 hist_bx_vs_secondaryParticle->Fill(3,(pathSum_11/1000)/c*1E9/bx);
0284 hist_bx_vs_secondaryParticle->Fill(4,(pathSum_2212/1000)/c*1E9/bx);
0285
0286
0287 }
0288
0289 }
0290
0291
0292 MakePlots("Gigi");
0293
0294
0295 }
0296
0297
0298 void Loopers::MakePlots(TString suffix) {
0299
0300 rootStyle();
0301
0302
0303
0304 TCanvas can_Gigi("can_Gigi","can_Gigi",1300,800);
0305
0306 can_Gigi.SetFillColor(kWhite);
0307
0308
0309
0310 can_Gigi.cd();
0311 hist_loops->SetLineColor(kBlue);
0312 hist_loops->SetFillColor(kWhite);
0313 hist_loops->Draw();
0314
0315
0316 theLogFile << endl << "--------" << endl;
0317 theLogFile << hist_loops->GetTitle() << endl;
0318 theLogFile << "\t Mean = " << hist_loops->GetMean() << endl;
0319 theLogFile << "\t RMS = " << hist_loops->GetRMS() << endl;
0320
0321
0322 can_Gigi.Update();
0323 can_Gigi.SaveAs( Form("%s/Loopers_Turns_%s.eps", theDirName.Data(), suffix.Data() ) );
0324 can_Gigi.SaveAs( Form("%s/Loopers_Turns_%s.gif", theDirName.Data(), suffix.Data() ) );
0325
0326
0327
0328 can_Gigi.cd();
0329 hist_energy_init->SetLineColor(kBlue);
0330 hist_energy_init->SetFillColor(kWhite);
0331 hist_energy_init->Draw();
0332
0333
0334 theLogFile << endl << "--------" << endl;
0335 theLogFile << hist_energy_init->GetTitle() << endl;
0336 theLogFile << "\t Mean = " << hist_energy_init->GetMean() << endl;
0337 theLogFile << "\t RMS = " << hist_energy_init->GetRMS() << endl;
0338
0339
0340 can_Gigi.Update();
0341 can_Gigi.SaveAs( Form("%s/Loopers_Energy_Init_%s.eps", theDirName.Data(), suffix.Data() ) );
0342 can_Gigi.SaveAs( Form("%s/Loopers_Energy_Init_%s.gif", theDirName.Data(), suffix.Data() ) );
0343
0344
0345
0346 can_Gigi.cd();
0347 hist_energy_end->SetLineColor(kBlue);
0348 hist_energy_end->SetFillColor(kWhite);
0349 hist_energy_end->Draw();
0350
0351
0352 theLogFile << endl << "--------" << endl;
0353 theLogFile << hist_energy_end->GetTitle() << endl;
0354 theLogFile << "\t Mean = " << hist_energy_end->GetMean() << endl;
0355 theLogFile << "\t RMS = " << hist_energy_end->GetRMS() << endl;
0356
0357
0358 can_Gigi.Update();
0359 can_Gigi.SaveAs( Form("%s/Loopers_Energy_End_%s.eps", theDirName.Data(), suffix.Data() ) );
0360 can_Gigi.SaveAs( Form("%s/Loopers_Energy_End_%s.gif", theDirName.Data(), suffix.Data() ) );
0361
0362
0363
0364 can_Gigi.cd();
0365 hist_energy_beforeend->SetLineColor(kBlue);
0366 hist_energy_beforeend->SetFillColor(kWhite);
0367 hist_energy_beforeend->Draw();
0368
0369
0370 theLogFile << endl << "--------" << endl;
0371 theLogFile << hist_energy_beforeend->GetTitle() << endl;
0372 theLogFile << "\t Mean = " << hist_energy_beforeend->GetMean() << endl;
0373 theLogFile << "\t RMS = " << hist_energy_beforeend->GetRMS() << endl;
0374
0375
0376 can_Gigi.Update();
0377 can_Gigi.SaveAs( Form("%s/Loopers_Energy_BeforeEnd_%s.eps", theDirName.Data(), suffix.Data() ) );
0378 can_Gigi.SaveAs( Form("%s/Loopers_Energy_BeforeEnd_%s.gif", theDirName.Data(), suffix.Data() ) );
0379
0380
0381
0382 can_Gigi.cd();
0383 hist_density->SetLineColor(kBlue);
0384 hist_density->SetFillColor(kWhite);
0385 hist_density->Draw();
0386
0387
0388 theLogFile << endl << "--------" << endl;
0389 theLogFile << hist_density->GetTitle() << endl;
0390 theLogFile << "\t Mean = " << hist_density->GetMean() << endl;
0391 theLogFile << "\t RMS = " << hist_density->GetRMS() << endl;
0392
0393
0394 can_Gigi.Update();
0395 can_Gigi.SaveAs( Form("%s/Loopers_Density_%s.eps", theDirName.Data(), suffix.Data() ) );
0396 can_Gigi.SaveAs( Form("%s/Loopers_Density_%s.gif", theDirName.Data(), suffix.Data() ) );
0397
0398
0399
0400 can_Gigi.cd();
0401 hist_lambda0->SetLineColor(kBlue);
0402 hist_lambda0->SetFillColor(kWhite);
0403 hist_lambda0->Draw();
0404
0405
0406 theLogFile << endl << "--------" << endl;
0407 theLogFile << hist_lambda0->GetTitle() << endl;
0408 theLogFile << "\t Mean = " << hist_lambda0->GetMean() << endl;
0409 theLogFile << "\t RMS = " << hist_lambda0->GetRMS() << endl;
0410
0411
0412 can_Gigi.Update();
0413 can_Gigi.SaveAs( Form("%s/Loopers_Lambda0_%s.eps", theDirName.Data(), suffix.Data() ) );
0414 can_Gigi.SaveAs( Form("%s/Loopers_Lambda0_%s.gif", theDirName.Data(), suffix.Data() ) );
0415
0416
0417
0418 can_Gigi.cd();
0419 hist_density_vs_loops->SetLineColor(kBlue);
0420 hist_density_vs_loops->SetFillColor(kBlue);
0421 hist_density_vs_loops->Draw("BOX");
0422
0423
0424 theLogFile << endl << "--------" << endl;
0425 theLogFile << hist_density_vs_loops->GetTitle() << endl;
0426 theLogFile << "\t Mean = " << hist_density_vs_loops->GetMean() << endl;
0427 theLogFile << "\t RMS = " << hist_density_vs_loops->GetRMS() << endl;
0428
0429
0430 can_Gigi.Update();
0431 can_Gigi.SaveAs( Form("%s/Loopers_Density_vs_Turns_%s.eps", theDirName.Data(), suffix.Data() ) );
0432 can_Gigi.SaveAs( Form("%s/Loopers_Density_vs_Turns_%s.gif", theDirName.Data(), suffix.Data() ) );
0433
0434
0435
0436 can_Gigi.cd();
0437 hist_pT_init->SetLineColor(kBlue);
0438 hist_pT_init->SetFillColor(kWhite);
0439 hist_pT_init->Draw();
0440
0441
0442 theLogFile << endl << "--------" << endl;
0443 theLogFile << hist_pT_init->GetTitle() << endl;
0444 theLogFile << "\t Mean = " << hist_pT_init->GetMean() << endl;
0445 theLogFile << "\t RMS = " << hist_pT_init->GetRMS() << endl;
0446
0447
0448 can_Gigi.Update();
0449 can_Gigi.SaveAs( Form("%s/Loopers_pT_Init_%s.eps", theDirName.Data(), suffix.Data() ) );
0450 can_Gigi.SaveAs( Form("%s/Loopers_pT_Init_%s.gif", theDirName.Data(), suffix.Data() ) );
0451
0452
0453
0454 can_Gigi.cd();
0455 hist_pT_end->SetLineColor(kBlue);
0456 hist_pT_end->SetFillColor(kWhite);
0457 hist_pT_end->Draw();
0458
0459
0460 theLogFile << endl << "--------" << endl;
0461 theLogFile << hist_pT_end->GetTitle() << endl;
0462 theLogFile << "\t Mean = " << hist_pT_end->GetMean() << endl;
0463 theLogFile << "\t RMS = " << hist_pT_end->GetRMS() << endl;
0464
0465
0466 can_Gigi.Update();
0467 can_Gigi.SaveAs( Form("%s/Loopers_pT_End_%s.eps", theDirName.Data(), suffix.Data() ) );
0468 can_Gigi.SaveAs( Form("%s/Loopers_pT_End_%s.gif", theDirName.Data(), suffix.Data() ) );
0469
0470
0471
0472 can_Gigi.cd();
0473 hist_energyLossPerTurn->SetLineColor(kBlue);
0474 hist_energyLossPerTurn->SetFillColor(kWhite);
0475 hist_energyLossPerTurn->Draw();
0476
0477
0478 theLogFile << endl << "--------" << endl;
0479 theLogFile << hist_energyLossPerTurn->GetTitle() << endl;
0480 theLogFile << "\t Mean = " << hist_energyLossPerTurn->GetMean() << endl;
0481 theLogFile << "\t RMS = " << hist_energyLossPerTurn->GetRMS() << endl;
0482
0483
0484 can_Gigi.Update();
0485 can_Gigi.SaveAs( Form("%s/Loopers_EnergyLossPerTurn_%s.eps", theDirName.Data(), suffix.Data() ) );
0486 can_Gigi.SaveAs( Form("%s/Loopers_EnergyLossPerTurn_%s.gif", theDirName.Data(), suffix.Data() ) );
0487
0488
0489
0490 can_Gigi.cd();
0491 hist_trackLength->SetLineColor(kBlue);
0492 hist_trackLength->SetFillColor(kWhite);
0493 hist_trackLength->Draw();
0494
0495
0496 theLogFile << endl << "--------" << endl;
0497 theLogFile << hist_trackLength->GetTitle() << endl;
0498 theLogFile << "\t Mean = " << hist_trackLength->GetMean() << endl;
0499 theLogFile << "\t RMS = " << hist_trackLength->GetRMS() << endl;
0500
0501
0502 can_Gigi.Update();
0503 can_Gigi.SaveAs( Form("%s/Loopers_trackLength_%s.eps", theDirName.Data(), suffix.Data() ) );
0504 can_Gigi.SaveAs( Form("%s/Loopers_trackLength_%s.gif", theDirName.Data(), suffix.Data() ) );
0505
0506
0507
0508 can_Gigi.cd();
0509 hist_trackLengthPerTurn->SetLineColor(kBlue);
0510 hist_trackLengthPerTurn->SetFillColor(kWhite);
0511 hist_trackLengthPerTurn->Draw();
0512
0513
0514 theLogFile << endl << "--------" << endl;
0515 theLogFile << hist_trackLengthPerTurn->GetTitle() << endl;
0516 theLogFile << "\t Mean = " << hist_trackLengthPerTurn->GetMean() << endl;
0517 theLogFile << "\t RMS = " << hist_trackLengthPerTurn->GetRMS() << endl;
0518
0519
0520 can_Gigi.Update();
0521 can_Gigi.SaveAs( Form("%s/Loopers_trackLengthPerTurn_%s.eps", theDirName.Data(), suffix.Data() ) );
0522 can_Gigi.SaveAs( Form("%s/Loopers_trackLengthPerTurn_%s.gif", theDirName.Data(), suffix.Data() ) );
0523
0524
0525
0526 hist_lastInteraction->GetXaxis()->SetBinLabel( 1,"Not Defined");
0527 hist_lastInteraction->GetXaxis()->SetBinLabel( 2,"Transportation");
0528 hist_lastInteraction->GetXaxis()->SetBinLabel( 3,"Electromagnetic");
0529 hist_lastInteraction->GetXaxis()->SetBinLabel( 4,"Optical");
0530 hist_lastInteraction->GetXaxis()->SetBinLabel( 5,"Hadronic");
0531 hist_lastInteraction->GetXaxis()->SetBinLabel( 6,"Photolepton Hadron");
0532 hist_lastInteraction->GetXaxis()->SetBinLabel( 7,"Decay");
0533 hist_lastInteraction->GetXaxis()->SetBinLabel( 8,"General");
0534 hist_lastInteraction->GetXaxis()->SetBinLabel( 9,"Parameterisation");
0535 hist_lastInteraction->GetXaxis()->SetBinLabel(10,"User Defined");
0536 hist_lastInteraction->GetXaxis()->SetBinLabel(11,"Other");
0537 hist_lastInteraction->GetXaxis()->SetTitle("");
0538
0539
0540 can_Gigi.cd();
0541 hist_lastInteraction->SetLineColor(kBlue);
0542 hist_lastInteraction->SetFillColor(kWhite);
0543 hist_lastInteraction->Draw();
0544
0545
0546 theLogFile << endl << "--------" << endl;
0547 theLogFile << hist_lastInteraction->GetTitle() << endl;
0548 theLogFile << "\t Mean = " << hist_lastInteraction->GetMean() << endl;
0549 theLogFile << "\t RMS = " << hist_lastInteraction->GetRMS() << endl;
0550 for(unsigned int iBin = 0; iBin<= hist_lastInteraction->GetNbinsX(); iBin++)
0551 theLogFile << "\t\t" << hist_lastInteraction->GetXaxis()->GetBinLabel(iBin) << " : "
0552 << hist_lastInteraction->GetBinContent(iBin) / hist_lastInteraction->GetEntries()
0553 << std::endl;
0554
0555
0556 can_Gigi.Update();
0557 can_Gigi.SaveAs( Form("%s/Loopers_lastInteraction_%s.eps", theDirName.Data(), suffix.Data() ) );
0558 can_Gigi.SaveAs( Form("%s/Loopers_lastInteraction_%s.gif", theDirName.Data(), suffix.Data() ) );
0559
0560
0561
0562 can_Gigi.cd();
0563 hist_bx->SetLineColor(kBlue);
0564 hist_bx->SetFillColor(kWhite);
0565 hist_bx->Draw();
0566
0567
0568 theLogFile << endl << "--------" << endl;
0569 theLogFile << hist_bx->GetTitle() << endl;
0570 theLogFile << "\t Mean = " << hist_bx->GetMean() << endl;
0571 theLogFile << "\t RMS = " << hist_bx->GetRMS() << endl;
0572 for(unsigned int iBin = 0; iBin<= hist_bx->GetNbinsX(); iBin++) {
0573 theLogFile << "\t\t bx " << hist_bx->GetBinCenter(iBin) << " : " << hist_bx->GetBinContent(iBin)
0574 << " integral > " << hist_bx->GetBinCenter(iBin)
0575 << " : " << hist_bx->Integral(iBin+1,hist_bx->GetNbinsX()+1) / hist_bx->Integral()
0576 << std::endl;
0577 }
0578
0579
0580 can_Gigi.Update();
0581 can_Gigi.SaveAs( Form("%s/Loopers_bx_%s.eps", theDirName.Data(), suffix.Data() ) );
0582 can_Gigi.SaveAs( Form("%s/Loopers_bx_%s.gif", theDirName.Data(), suffix.Data() ) );
0583
0584
0585
0586 can_Gigi.cd();
0587 hist_bx_finer->SetLineColor(kBlue);
0588 hist_bx_finer->SetFillColor(kWhite);
0589 hist_bx_finer->Draw();
0590
0591
0592 theLogFile << endl << "--------" << endl;
0593 theLogFile << hist_bx_finer->GetTitle() << endl;
0594 theLogFile << "\t Mean = " << hist_bx_finer->GetMean() << endl;
0595 theLogFile << "\t RMS = " << hist_bx_finer->GetRMS() << endl;
0596 for(unsigned int iBin = 0; iBin<= hist_bx_finer->GetNbinsX(); iBin++) {
0597 theLogFile << "\t\t bx_finer " << hist_bx_finer->GetBinCenter(iBin) << " : " << hist_bx_finer->GetBinContent(iBin)
0598 << " integral > " << hist_bx_finer->GetBinCenter(iBin)
0599 << " : " << hist_bx_finer->Integral(iBin+1,hist_bx_finer->GetNbinsX()+1) / hist_bx_finer->Integral()
0600 << std::endl;
0601 }
0602
0603
0604 can_Gigi.Update();
0605 can_Gigi.SaveAs( Form("%s/Loopers_bx_finer_%s.eps", theDirName.Data(), suffix.Data() ) );
0606 can_Gigi.SaveAs( Form("%s/Loopers_bx_finer_%s.gif", theDirName.Data(), suffix.Data() ) );
0607
0608
0609
0610 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetBinLabel( 1,"Not Defined");
0611 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetBinLabel( 2,"Transportation");
0612 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetBinLabel( 3,"Electromagnetic");
0613 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetBinLabel( 4,"Optical");
0614 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetBinLabel( 5,"Hadronic");
0615 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetBinLabel( 6,"Photolepton Hadron");
0616 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetBinLabel( 7,"Decay");
0617 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetBinLabel( 8,"General");
0618 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetBinLabel( 9,"Parameterisation");
0619 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetBinLabel(10,"User Defined");
0620 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetBinLabel(11,"Other");
0621 hist_energybeforeend_vs_lastInteraction->GetXaxis()->SetTitle("");
0622
0623 can_Gigi.cd();
0624 hist_energybeforeend_vs_lastInteraction->SetLineColor(kBlue);
0625 hist_energybeforeend_vs_lastInteraction->SetFillColor(kBlue);
0626 hist_energybeforeend_vs_lastInteraction->Draw("BOX");
0627
0628
0629 theLogFile << endl << "--------" << endl;
0630 theLogFile << hist_energybeforeend_vs_lastInteraction->GetTitle() << endl;
0631 theLogFile << "\t Mean = " << hist_energybeforeend_vs_lastInteraction->GetMean() << endl;
0632 theLogFile << "\t RMS = " << hist_energybeforeend_vs_lastInteraction->GetRMS() << endl;
0633
0634
0635 can_Gigi.Update();
0636 can_Gigi.SaveAs( Form("%s/Loopers_EnergyBeforeEnd_vs_lastInteraction_%s.eps", theDirName.Data(), suffix.Data() ) );
0637 can_Gigi.SaveAs( Form("%s/Loopers_EnergyBeforeEnd_vs_lastInteraction_%s.gif", theDirName.Data(), suffix.Data() ) );
0638
0639
0640
0641 hist_trackLength_vs_lastInteraction->GetXaxis()->SetBinLabel( 1,"Not Defined");
0642 hist_trackLength_vs_lastInteraction->GetXaxis()->SetBinLabel( 2,"Transportation");
0643 hist_trackLength_vs_lastInteraction->GetXaxis()->SetBinLabel( 3,"Electromagnetic");
0644 hist_trackLength_vs_lastInteraction->GetXaxis()->SetBinLabel( 4,"Optical");
0645 hist_trackLength_vs_lastInteraction->GetXaxis()->SetBinLabel( 5,"Hadronic");
0646 hist_trackLength_vs_lastInteraction->GetXaxis()->SetBinLabel( 6,"Photolepton Hadron");
0647 hist_trackLength_vs_lastInteraction->GetXaxis()->SetBinLabel( 7,"Decay");
0648 hist_trackLength_vs_lastInteraction->GetXaxis()->SetBinLabel( 8,"General");
0649 hist_trackLength_vs_lastInteraction->GetXaxis()->SetBinLabel( 9,"Parameterisation");
0650 hist_trackLength_vs_lastInteraction->GetXaxis()->SetBinLabel(10,"User Defined");
0651 hist_trackLength_vs_lastInteraction->GetXaxis()->SetBinLabel(11,"Other");
0652 hist_trackLength_vs_lastInteraction->GetXaxis()->SetTitle("");
0653
0654 can_Gigi.cd();
0655 hist_trackLength_vs_lastInteraction->SetLineColor(kBlue);
0656 hist_trackLength_vs_lastInteraction->SetFillColor(kBlue);
0657 hist_trackLength_vs_lastInteraction->Draw("BOX");
0658
0659
0660 theLogFile << endl << "--------" << endl;
0661 theLogFile << hist_trackLength_vs_lastInteraction->GetTitle() << endl;
0662 theLogFile << "\t Mean = " << hist_trackLength_vs_lastInteraction->GetMean() << endl;
0663 theLogFile << "\t RMS = " << hist_trackLength_vs_lastInteraction->GetRMS() << endl;
0664
0665
0666 can_Gigi.Update();
0667 can_Gigi.SaveAs( Form("%s/Loopers_trackLength_vs_lastInteraction_%s.eps", theDirName.Data(), suffix.Data() ) );
0668 can_Gigi.SaveAs( Form("%s/Loopers_trackLength_vs_lastInteraction_%s.gif", theDirName.Data(), suffix.Data() ) );
0669
0670
0671
0672 can_Gigi.cd();
0673 hist_hadronicInteractions->SetLineColor(kBlue);
0674 hist_hadronicInteractions->SetFillColor(kWhite);
0675 hist_hadronicInteractions->Draw();
0676
0677
0678 theLogFile << endl << "--------" << endl;
0679 theLogFile << hist_hadronicInteractions->GetTitle() << endl;
0680 theLogFile << "\t Mean = " << hist_hadronicInteractions->GetMean() << endl;
0681 theLogFile << "\t RMS = " << hist_hadronicInteractions->GetRMS() << endl;
0682
0683
0684 can_Gigi.Update();
0685 can_Gigi.SaveAs( Form("%s/Loopers_HadronicInteractions_%s.eps", theDirName.Data(), suffix.Data() ) );
0686 can_Gigi.SaveAs( Form("%s/Loopers_HadronicInteractions_%s.gif", theDirName.Data(), suffix.Data() ) );
0687
0688
0689
0690 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetBinLabel( 1,"Not Defined");
0691 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetBinLabel( 2,"Transportation");
0692 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetBinLabel( 3,"Electromagnetic");
0693 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetBinLabel( 4,"Optical");
0694 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetBinLabel( 5,"Hadronic");
0695 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetBinLabel( 6,"Photolepton Hadron");
0696 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetBinLabel( 7,"Decay");
0697 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetBinLabel( 8,"General");
0698 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetBinLabel( 9,"Parameterisation");
0699 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetBinLabel(10,"User Defined");
0700 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetBinLabel(11,"Other");
0701 hist_hadronicInteractions_vs_lastInteraction->GetXaxis()->SetTitle("");
0702
0703 can_Gigi.cd();
0704 hist_hadronicInteractions_vs_lastInteraction->SetLineColor(kBlue);
0705 hist_hadronicInteractions_vs_lastInteraction->SetFillColor(kBlue);
0706 hist_hadronicInteractions_vs_lastInteraction->Draw("BOX");
0707
0708
0709 theLogFile << endl << "--------" << endl;
0710 theLogFile << hist_hadronicInteractions_vs_lastInteraction->GetTitle() << endl;
0711
0712
0713
0714
0715 can_Gigi.Update();
0716 can_Gigi.SaveAs( Form("%s/Loopers_HadronicInteractions_vs_lastInteraction_%s.eps", theDirName.Data(), suffix.Data() ) );
0717 can_Gigi.SaveAs( Form("%s/Loopers_Hadronicinteractions_vs_lastInteraction_%s.gif", theDirName.Data(), suffix.Data() ) );
0718
0719
0720
0721 can_Gigi.cd();
0722 hist_energyLossHadronicInteractions->SetLineColor(kBlue);
0723 hist_energyLossHadronicInteractions->SetFillColor(kWhite);
0724 hist_energyLossHadronicInteractions->Draw();
0725
0726
0727 theLogFile << endl << "--------" << endl;
0728 theLogFile << hist_energyLossHadronicInteractions->GetTitle() << endl;
0729 theLogFile << "\t Mean = " << hist_energyLossHadronicInteractions->GetMean() << endl;
0730 theLogFile << "\t RMS = " << hist_energyLossHadronicInteractions->GetRMS() << endl;
0731
0732
0733 can_Gigi.Update();
0734 can_Gigi.SaveAs( Form("%s/Loopers_EnergyLossHadronicInteractions_%s.eps", theDirName.Data(), suffix.Data() ) );
0735 can_Gigi.SaveAs( Form("%s/Loopers_EnergyLossHadronicInteractions_%s.gif", theDirName.Data(), suffix.Data() ) );
0736
0737
0738
0739 hist_productionEnergy_vs_secondaryParticle->GetXaxis()->SetBinLabel( 1,"#pi^{#pm}");
0740 hist_productionEnergy_vs_secondaryParticle->GetXaxis()->SetBinLabel( 2,"#mu^{#pm}");
0741 hist_productionEnergy_vs_secondaryParticle->GetXaxis()->SetBinLabel( 3,"e^{#pm}");
0742 hist_productionEnergy_vs_secondaryParticle->GetXaxis()->SetBinLabel( 4,"p/#bar{p}");
0743
0744 can_Gigi.cd();
0745 hist_productionEnergy_vs_secondaryParticle->SetLineColor(kBlue);
0746 hist_productionEnergy_vs_secondaryParticle->SetFillColor(kBlue);
0747 hist_productionEnergy_vs_secondaryParticle->Draw("BOX");
0748
0749
0750 theLogFile << endl << "--------" << endl;
0751 theLogFile << hist_productionEnergy_vs_secondaryParticle->GetTitle() << endl;
0752
0753
0754
0755
0756 can_Gigi.Update();
0757 can_Gigi.SaveAs( Form("%s/Loopers_ProductionEnergy_vs_SecondaryParticle_%s.eps", theDirName.Data(), suffix.Data() ) );
0758 can_Gigi.SaveAs( Form("%s/Loopers_ProductionEnergy_vs_SecondaryParticle_%s.gif", theDirName.Data(), suffix.Data() ) );
0759
0760
0761
0762 can_Gigi.cd();
0763 hist_productionEnergy_vs_secondaryParticle->SetLineColor(kBlack);
0764 hist_productionEnergy_vs_secondaryParticle->SetMarkerColor(kBlue);
0765 hist_productionEnergy_vs_secondaryParticle->SetMarkerStyle(20);
0766 hist_productionEnergy_vs_secondaryParticle->Draw("AXIS");
0767 hist_productionEnergy_vs_secondaryParticle->ProfileX()->Draw("E1,SAME");
0768
0769 can_Gigi.Update();
0770 can_Gigi.SaveAs( Form("%s/Loopers_ProductionEnergy_vs_SecondaryParticle_profile_%s.eps", theDirName.Data(), suffix.Data() ) );
0771 can_Gigi.SaveAs( Form("%s/Loopers_ProductionEnergy_vs_SecondaryParticle_profile_%s.gif", theDirName.Data(), suffix.Data() ) );
0772
0773
0774
0775 hist_bx_vs_secondaryParticle->GetXaxis()->SetBinLabel( 1,"#pi^{#pm}");
0776 hist_bx_vs_secondaryParticle->GetXaxis()->SetBinLabel( 2,"#mu^{#pm}");
0777 hist_bx_vs_secondaryParticle->GetXaxis()->SetBinLabel( 3,"e^{#pm}");
0778 hist_bx_vs_secondaryParticle->GetXaxis()->SetBinLabel( 4,"p/#bar{p}");
0779
0780 can_Gigi.cd();
0781 hist_bx_vs_secondaryParticle->GetYaxis()->SetRangeUser(0.,5.);
0782 hist_bx_vs_secondaryParticle->SetLineColor(kBlue);
0783 hist_bx_vs_secondaryParticle->SetFillColor(kBlue);
0784 hist_bx_vs_secondaryParticle->Draw("BOX");
0785
0786
0787 theLogFile << endl << "--------" << endl;
0788 theLogFile << hist_bx_vs_secondaryParticle->GetTitle() << endl;
0789
0790
0791
0792
0793
0794 can_Gigi.Update();
0795 can_Gigi.SaveAs( Form("%s/Loopers_bx_vs_SecondaryParticle_%s.eps", theDirName.Data(), suffix.Data() ) );
0796 can_Gigi.SaveAs( Form("%s/Loopers_bx_vs_SecondaryParticle_%s.gif", theDirName.Data(), suffix.Data() ) );
0797
0798
0799 can_Gigi.cd();
0800 hist_bx_vs_secondaryParticle->SetLineColor(kBlack);
0801 hist_bx_vs_secondaryParticle->SetMarkerColor(kBlue);
0802 hist_bx_vs_secondaryParticle->SetMarkerStyle(20);
0803 hist_bx_vs_secondaryParticle->Draw("AXIS");
0804 hist_bx_vs_secondaryParticle->ProfileX()->Draw("E1,SAME");
0805
0806 can_Gigi.Update();
0807 can_Gigi.SaveAs( Form("%s/Loopers_bx_vs_SecondaryParticle_profile_%s.eps", theDirName.Data(), suffix.Data() ) );
0808 can_Gigi.SaveAs( Form("%s/Loopers_bx_vs_SecondaryParticle_profile_%s.gif", theDirName.Data(), suffix.Data() ) );
0809
0810
0811
0812 hist_bx_vs_secondaryParticle->GetXaxis()->SetRangeUser(0.5,1.5);
0813 hist_bx_vs_secondaryParticle->Draw("BOX");
0814
0815 can_Gigi.Update();
0816 can_Gigi.SaveAs( Form("%s/Loopers_bx_vs_SecondaryParticle_pimu_%s.eps", theDirName.Data(), suffix.Data() ) );
0817 can_Gigi.SaveAs( Form("%s/Loopers_bx_vs_SecondaryParticle_pimu_%s.gif", theDirName.Data(), suffix.Data() ) );
0818
0819
0820 hist_bx_vs_secondaryParticle->GetXaxis()->SetRangeUser(3.5,4.5);
0821 hist_bx_vs_secondaryParticle->Draw("BOX");
0822
0823 can_Gigi.Update();
0824 can_Gigi.SaveAs( Form("%s/Loopers_bx_vs_SecondaryParticle_p_%s.eps", theDirName.Data(), suffix.Data() ) );
0825 can_Gigi.SaveAs( Form("%s/Loopers_bx_vs_SecondaryParticle_p_%s.gif", theDirName.Data(), suffix.Data() ) );
0826
0827
0828 hist_bx_vs_secondaryParticle->GetXaxis()->SetRangeUser(3.5,4.5);
0829 hist_bx_vs_secondaryParticle->ProjectionY(" ",4,4)->GetXaxis()->SetRangeUser(0.,5.);
0830 hist_bx_vs_secondaryParticle->ProjectionY(" ",4,4)->Draw();
0831
0832 can_Gigi.Update();
0833 can_Gigi.SaveAs( Form("%s/Loopers_bx_vs_SecondaryParticle_projection_p_%s.eps", theDirName.Data(), suffix.Data() ) );
0834 can_Gigi.SaveAs( Form("%s/Loopers_bx_vs_SecondaryParticle_projection_p_%s.gif", theDirName.Data(), suffix.Data() ) );
0835
0836
0837
0838 }
0839
0840 void Loopers::rootStyle() {
0841
0842 TStyle* rrStyle = new TStyle("rootStyle","rootStyle");
0843 TGaxis::SetMaxDigits(3);
0844 rrStyle->SetOptStat(0000);
0845 rrStyle->SetOptFit(1111);
0846 rrStyle->SetOptLogy(0);
0847 rrStyle->SetCanvasColor(kWhite);
0848 rrStyle->SetHistFillColor(34);
0849 rrStyle->SetFuncColor(146);
0850
0851 rrStyle->SetLabelSize(0.04,"x,y,z");
0852 rrStyle->SetTitleSize(0.05,"x,y,z");
0853 rrStyle->SetTitleOffset(0.8,"x,y,z");
0854 rrStyle->SetTitleFontSize(0.06);
0855
0856 rrStyle->SetHistLineWidth(1);
0857
0858 rrStyle->SetPaintTextFormat("g");
0859
0860 rrStyle->SetTitleBorderSize(0);
0861 rrStyle->SetTitleFillColor(0);
0862 rrStyle->SetTitleFont(12,"pad");
0863 rrStyle->SetTitleFontSize(0.04);
0864 rrStyle->SetTitleX(0.075);
0865 rrStyle->SetTitleY(0.950);
0866
0867 rrStyle->SetLegendBorderSize(0);
0868 rrStyle->SetFillColor(0);
0869
0870
0871
0872 gROOT->SetBatch();
0873 gROOT->SetStyle("rootStyle");
0874
0875 }
0876
0877 void Loopers::helpfulCommands() {
0878 cout << "########################################" << endl;
0879 cout << "a.Loop()" << endl;
0880 cout << "########################################" << endl;
0881 }