3673{
3674 cout << "-------------------------------------------------------------------------------------------"<< endl;
3675 cout << endl;
3676 cout << "EdbShowerAlgESimple::WriteNewRootFile -------------------------------------------"<< endl;
3677 cout << "EdbShowerAlgESimple::WriteNewRootFile This is NOT a good solution! But what shall" << endl;
3678 cout << "EdbShowerAlgESimple::WriteNewRootFile I do?" << endl;
3679 cout << "EdbShowerAlgESimple::WriteNewRootFile We rewrite completely the new tree and add " << endl;
3680 cout << "EdbShowerAlgESimple::WriteNewRootFile the new calculated energy values to it..." << endl;
3681 cout << "EdbShowerAlgESimple::WriteNewRootFile -------------------------------------------"<< endl;
3682 cout << endl;
3683
3684
3685
3686
3687 cout << "EdbShowerAlgESimple::WriteNewRootFile Open sourcefilename:: "<< sourcefilename.Data() << endl;
3688 cout << "EdbShowerAlgESimple::WriteNewRootFile Open treename:: "<< treename.Data() << endl;
3689
3690
3715 Int_t shower_eProb90;
3716 Int_t shower_eProb1;
3717 Int_t shower_Size;
3718 Int_t shower_Size15;
3719 Int_t shower_Size20;
3720 Int_t shower_Size30;
3721 Float_t shower_output;
3722 Float_t shower_output15;
3723 Float_t shower_output20;
3724 Float_t shower_output30;
3725 Float_t shower_output50;
3726 Float_t shower_purityb;
3728 Float_t shower_E_MC;
3729 Float_t shower_EnergyCorrectedb;
3730 Float_t shower_EnergyUnCorrectedb;
3731 Float_t shower_EnergySigmaCorrectedb;
3732 Float_t shower_EnergySigmaUnCorrectedb;
3733
3734 Float_t shower_OldEnergyCorrectedb;
3735 Float_t shower_OldEnergyUnCorrectedb;
3736 Float_t shower_OldEnergySigmaCorrectedb;
3737 Float_t shower_OldEnergySigmaUnCorrectedb;
3738
3739 Int_t shower_mcDigitIndexTop[1000];
3740 Int_t shower_mcDigitIndexBottom[1000];
3741
3742 TFile* fileOld = new TFile(sourcefilename.Data(),"READ");
3743
3744 TTree* eShowerTree = (TTree*)fileOld->Get(treename);
3745 cout << "eShowerTree = " << eShowerTree << endl;
3752 eShowerTree->SetBranchAddress("output15", &shower_output15);
3753 eShowerTree->SetBranchAddress("output20", &shower_output20);
3754 eShowerTree->SetBranchAddress("output30", &shower_output30);
3755 eShowerTree->SetBranchAddress("output50", &shower_output50);
3756 eShowerTree->SetBranchAddress("eProb1", &shower_eProb1);
3757 eShowerTree->SetBranchAddress("eProb90", &shower_eProb90);
3759 eShowerTree->SetBranchAddress(
"xb",
shower_xb);
3760 eShowerTree->SetBranchAddress(
"yb",
shower_yb);
3761 eShowerTree->SetBranchAddress(
"zb",
shower_zb);
3762 eShowerTree->SetBranchAddress(
"txb",
shower_txb);
3763 eShowerTree->SetBranchAddress(
"tyb",
shower_tyb);
3775
3776 eShowerTree->SetBranchAddress("E_MC",&shower_E_MC);
3778 eShowerTree->SetBranchAddress(
"idb",
shower_idb);
3780
3781
3782 eShowerTree->SetBranchAddress("purityb",&shower_purityb);
3783 eShowerTree->SetBranchAddress("Energy",&shower_OldEnergyCorrectedb);
3784 eShowerTree->SetBranchAddress("EnergyUnCorrected",&shower_OldEnergyUnCorrectedb);
3785 eShowerTree->SetBranchAddress("EnergySigma",&shower_OldEnergySigmaCorrectedb);
3786 eShowerTree->SetBranchAddress("EnergySigmaUnCorrected",&shower_OldEnergySigmaUnCorrectedb);
3787 eShowerTree->SetBranchAddress("mcDigitIndexTop",shower_mcDigitIndexTop);
3788 eShowerTree->SetBranchAddress("mcDigitIndexBottom",shower_mcDigitIndexBottom);
3789
3790
3791 Int_t nent=eShowerTree->GetEntries();
3792 cout << "EdbShowerAlgESimple::WriteNewRootFile eShowerTree="<< eShowerTree <<" ------"<< endl;
3793 cout << "EdbShowerAlgESimple::WriteNewRootFile eShowerTree->GetEntries()="<< nent <<" ------"<< endl;
3794
3795
3796
3797 TFile* fileNew = new TFile("New.root","RECREATE");
3798
3799 TTree* ShowerTreeNew=new TTree("treebranch","treebranch");
3800 cout << "EdbShowerAlgESimple::WriteNewRootFile ShowerTreeNew="<< ShowerTreeNew <<" ------"<< endl;
3801
3803 ShowerTreeNew->Branch(
"sizeb",&
shower_sizeb,
"sizeb/I");
3807 ShowerTreeNew->Branch("output15",&shower_output15,"output15/F");
3808 ShowerTreeNew->Branch("output20",&shower_output20,"output20/F");
3809 ShowerTreeNew->Branch("output30",&shower_output30,"output30/F");
3810 ShowerTreeNew->Branch("output50",&shower_output50,"output50/F");
3811 ShowerTreeNew->Branch("eProb90",&shower_eProb90,"eProb90/I");
3812 ShowerTreeNew->Branch("eProb1",&shower_eProb1,"eProb1/I");
3813 ShowerTreeNew->Branch("E_MC",&shower_E_MC,"E_MC/F");
3814 ShowerTreeNew->Branch(
"idb",
shower_idb,
"idb[sizeb]/I");
3815 ShowerTreeNew->Branch(
"plateb",
shower_plateb,
"plateb[sizeb]/I");
3818 ShowerTreeNew->Branch(
"xb",
shower_xb,
"xb[sizeb]/F");
3819 ShowerTreeNew->Branch(
"yb",
shower_yb,
"yb[sizeb]/F");
3820 ShowerTreeNew->Branch(
"zb",
shower_zb,
"zb[sizeb]/F");
3821 ShowerTreeNew->Branch(
"txb",
shower_txb,
"txb[sizeb]/F");
3822 ShowerTreeNew->Branch(
"tyb",
shower_tyb,
"tyb[sizeb]/F");
3823 ShowerTreeNew->Branch(
"nfilmb",
shower_nfilmb,
"nfilmb[sizeb]/I");
3828 ShowerTreeNew->Branch(
"chi2btkb",
shower_chi2btkb,
"chi2btkb[sizeb]/F");
3829 ShowerTreeNew->Branch(
"deltarb",
shower_deltarb,
"deltarb[sizeb]/F");
3831 ShowerTreeNew->Branch(
"deltaxb",
shower_deltaxb,
"deltaxb[sizeb]/F");
3832 ShowerTreeNew->Branch(
"deltayb",
shower_deltayb,
"deltayb[sizeb]/F");
3834 ShowerTreeNew->Branch("purityb",&shower_purityb,"purityb/F");
3836
3837 ShowerTreeNew->Branch("Energy",&shower_EnergyCorrectedb,"EnergyCorrectedb/F");
3838 ShowerTreeNew->Branch("EnergyUnCorrected",&shower_EnergyUnCorrectedb,"EnergyUnCorrectedb/F");
3839 ShowerTreeNew->Branch("EnergySigma",&shower_EnergySigmaCorrectedb,"EnergySigmaCorrectedb/F");
3840 ShowerTreeNew->Branch("EnergySigmaUnCorrected",&shower_EnergySigmaUnCorrectedb,"EnergySigmaUnCorrectedb/F");
3841
3842 ShowerTreeNew->Branch("OldEnergy",&shower_OldEnergyCorrectedb,"OldEnergy/F");
3843 ShowerTreeNew->Branch("OldEnergyUnCorrected",&shower_OldEnergyUnCorrectedb,"OldEnergyUnCorrected/F");
3844 ShowerTreeNew->Branch("OldEnergySigma",&shower_OldEnergySigmaCorrectedb,"OldEnergySigma/F");
3845 ShowerTreeNew->Branch("OldEnergySigmaUnCorrected",&shower_OldEnergySigmaUnCorrectedb,"OldEnergySigmaUnCorrected/F");
3846 ShowerTreeNew->Branch("mcDigitIndexTop",shower_mcDigitIndexTop,"mcDigitIndexTop[sizeb]/I");
3847 ShowerTreeNew->Branch("mcDigitIndexBottom",shower_mcDigitIndexBottom,"mcDigitIndexBottom[sizeb]/I");
3848
3849
3850
3851 for (int i=0; i<nent; ++i) {
3852 eShowerTree->GetEntry(i);
3853
3854
3858 shower_EnergySigmaUnCorrectedb=-999;
3859
3860
3861 ShowerTreeNew->Fill();
3862 }
3863 ShowerTreeNew->Write();
3864 fileNew->Close();
3865 fileOld->Close();
3866
3867
3868
3869 gSystem->Exec("mv -vf Shower.root Shower.Orig.root");
3870 gSystem->Exec("mv -vf New.root Shower.root");
3871 cout << "EdbShowerAlgESimple::WriteNewRootFile...done."<<endl;
3872 cout << "-------------------------------------------------------------------------------------------"<< endl<< endl;
3873 return;
3874}
Int_t shower_nfilmb[5000]
Definition: ShowRec.h:382
Int_t shower_showerID
Definition: ShowRec.h:370
Float_t shower_ntrace3simub[5000]
Definition: ShowRec.h:387
Float_t shower_deltaxb[5000]
Definition: ShowRec.h:380
Int_t shower_sizeb20
Definition: ShowRec.h:371
Float_t shower_purb
Definition: ShowRec.h:394
Int_t shower_numberofilms
Definition: ShowRec.h:393
Int_t shower_ntrace2simub[5000]
Definition: ShowRec.h:386
Float_t shower_energy_shot_particle
Definition: ShowRec.h:372
Float_t shower_trackdensb
Definition: ShowRec.h:395
Int_t shower_idb[5000]
Definition: ShowRec.h:390
Int_t shower_number_eventb
Definition: ShowRec.h:370
Int_t shower_sizeb15
Definition: ShowRec.h:371
Float_t shower_deltasigmathetab[58]
Definition: ShowRec.h:392
Float_t shower_tagprimary[5000]
Definition: ShowRec.h:389
Int_t shower_isizeb
Definition: ShowRec.h:370
Float_t shower_deltayb[5000]
Definition: ShowRec.h:381
Int_t shower_sizeb30
Definition: ShowRec.h:371
Int_t shower_ntrace4simub[5000]
Definition: ShowRec.h:388
Int_t shower_sizeb
Definition: ShowRec.h:370
Float_t shower_chi2btkb[5000]
Definition: ShowRec.h:384
Int_t shower_plateb[5000]
Definition: ShowRec.h:391
Int_t shower_ntrace1simub[5000]
Definition: ShowRec.h:385