1200{
1201 cout << "-------------------------------------------------------------------------------------------"<< endl;
1202 cout << endl;
1203 cout << "EdbShowAlgE_Simple::WriteNewRootFile -------------------------------------------"<< endl;
1204 cout << "EdbShowAlgE_Simple::WriteNewRootFile This is NOT a good solution! But what shall" << endl;
1205 cout << "EdbShowAlgE_Simple::WriteNewRootFile I do?" << endl;
1206 cout << "EdbShowAlgE_Simple::WriteNewRootFile We rewrite completely the new tree and add " << endl;
1207 cout << "EdbShowAlgE_Simple::WriteNewRootFile the new calculated energy values to it..." << endl;
1208 cout << "EdbShowAlgE_Simple::WriteNewRootFile -------------------------------------------"<< endl;
1209 cout << endl;
1210
1211
1236 Int_t shower_eProb90;
1237 Int_t shower_eProb1;
1238 Int_t shower_Size;
1239 Int_t shower_Size15;
1240 Int_t shower_Size20;
1241 Int_t shower_Size30;
1242 Float_t shower_output;
1243 Float_t shower_output15;
1244 Float_t shower_output20;
1245 Float_t shower_output30;
1246 Float_t shower_output50;
1247 Float_t shower_purityb;
1249 Float_t shower_E_MC;
1250 Float_t shower_EnergyCorrectedb;
1251 Float_t shower_EnergyUnCorrectedb;
1252 Float_t shower_EnergySigmaCorrectedb;
1253 Float_t shower_EnergySigmaUnCorrectedb;
1254
1255 Float_t shower_OldEnergyCorrectedb;
1256 Float_t shower_OldEnergyUnCorrectedb;
1257 Float_t shower_OldEnergySigmaCorrectedb;
1258 Float_t shower_OldEnergySigmaUnCorrectedb;
1259
1260
1261 TFile* fileOld = new TFile("Shower.root","READ");
1262
1263 TTree* eShowerTree = (TTree*)fileOld->Get("treebranch");
1264 cout << "eShowerTree = " << eShowerTree << endl;
1271 eShowerTree->SetBranchAddress("output15", &shower_output15);
1272 eShowerTree->SetBranchAddress("output20", &shower_output20);
1273 eShowerTree->SetBranchAddress("output30", &shower_output30);
1274 eShowerTree->SetBranchAddress("output50", &shower_output50);
1275 eShowerTree->SetBranchAddress("eProb1", &shower_eProb1);
1276 eShowerTree->SetBranchAddress("eProb90", &shower_eProb90);
1278 eShowerTree->SetBranchAddress(
"xb",
shower_xb);
1279 eShowerTree->SetBranchAddress(
"yb",
shower_yb);
1280 eShowerTree->SetBranchAddress(
"zb",
shower_zb);
1281 eShowerTree->SetBranchAddress(
"txb",
shower_txb);
1282 eShowerTree->SetBranchAddress(
"tyb",
shower_tyb);
1294
1295 eShowerTree->SetBranchAddress("E_MC",&shower_E_MC);
1297 eShowerTree->SetBranchAddress(
"idb",
shower_idb);
1299
1300
1301 eShowerTree->SetBranchAddress("purityb",&shower_purityb);
1302 eShowerTree->SetBranchAddress("Energy",&shower_OldEnergyCorrectedb);
1303 eShowerTree->SetBranchAddress("EnergyUnCorrected",&shower_OldEnergyUnCorrectedb);
1304 eShowerTree->SetBranchAddress("EnergySigma",&shower_OldEnergySigmaCorrectedb);
1305 eShowerTree->SetBranchAddress("EnergySigmaUnCorrected",&shower_OldEnergySigmaUnCorrectedb);
1306
1307
1308 Int_t nent=eShowerTree->GetEntries();
1309 cout << "EdbShowAlgE_Simple::WriteNewRootFile eShowerTree="<< eShowerTree <<" ------"<< endl;
1310 cout << "EdbShowAlgE_Simple::WriteNewRootFile eShowerTree->GetEntries()="<< nent <<" ------"<< endl;
1311
1312
1313
1314 TFile* fileNew = new TFile("New.root","RECREATE");
1315
1316 TTree* ShowerTreeNew=new TTree("treebranch","treebranch");
1317 cout << "EdbShowAlgE_Simple::WriteNewRootFile ShowerTreeNew="<< ShowerTreeNew <<" ------"<< endl;
1318
1320 ShowerTreeNew->Branch(
"sizeb",&
shower_sizeb,
"sizeb/I");
1324 ShowerTreeNew->Branch("output15",&shower_output15,"output15/F");
1325 ShowerTreeNew->Branch("output20",&shower_output20,"output20/F");
1326 ShowerTreeNew->Branch("output30",&shower_output30,"output30/F");
1327 ShowerTreeNew->Branch("output50",&shower_output50,"output50/F");
1328 ShowerTreeNew->Branch("eProb90",&shower_eProb90,"eProb90/I");
1329 ShowerTreeNew->Branch("eProb1",&shower_eProb1,"eProb1/I");
1330 ShowerTreeNew->Branch("E_MC",&shower_E_MC,"E_MC/F");
1331 ShowerTreeNew->Branch(
"idb",
shower_idb,
"idb[sizeb]/I");
1332 ShowerTreeNew->Branch(
"plateb",
shower_plateb,
"plateb[sizeb]/I");
1335 ShowerTreeNew->Branch(
"xb",
shower_xb,
"xb[sizeb]/F");
1336 ShowerTreeNew->Branch(
"yb",
shower_yb,
"yb[sizeb]/F");
1337 ShowerTreeNew->Branch(
"zb",
shower_zb,
"zb[sizeb]/F");
1338 ShowerTreeNew->Branch(
"txb",
shower_txb,
"txb[sizeb]/F");
1339 ShowerTreeNew->Branch(
"tyb",
shower_tyb,
"tyb[sizeb]/F");
1340 ShowerTreeNew->Branch(
"nfilmb",
shower_nfilmb,
"nfilmb[sizeb]/I");
1345 ShowerTreeNew->Branch(
"chi2btkb",
shower_chi2btkb,
"chi2btkb[sizeb]/F");
1346 ShowerTreeNew->Branch(
"deltarb",
shower_deltarb,
"deltarb[sizeb]/F");
1348 ShowerTreeNew->Branch(
"deltaxb",
shower_deltaxb,
"deltaxb[sizeb]/F");
1349 ShowerTreeNew->Branch(
"deltayb",
shower_deltayb,
"deltayb[sizeb]/F");
1351 ShowerTreeNew->Branch("purityb",&shower_purityb,"purityb/F");
1353
1354 ShowerTreeNew->Branch("Energy",&shower_EnergyCorrectedb,"EnergyCorrectedb/F");
1355 ShowerTreeNew->Branch("EnergyUnCorrected",&shower_EnergyUnCorrectedb,"EnergyUnCorrectedb/F");
1356 ShowerTreeNew->Branch("EnergySigma",&shower_EnergySigmaCorrectedb,"EnergySigmaCorrectedb/F");
1357 ShowerTreeNew->Branch("EnergySigmaUnCorrected",&shower_EnergySigmaUnCorrectedb,"EnergySigmaUnCorrectedb/F");
1358
1359 ShowerTreeNew->Branch("OldEnergy",&shower_OldEnergyCorrectedb,"OldEnergy/F");
1360 ShowerTreeNew->Branch("OldEnergyUnCorrected",&shower_OldEnergyUnCorrectedb,"OldEnergyUnCorrected/F");
1361 ShowerTreeNew->Branch("OldEnergySigma",&shower_OldEnergySigmaCorrectedb,"OldEnergySigma/F");
1362 ShowerTreeNew->Branch("OldEnergySigmaUnCorrected",&shower_OldEnergySigmaUnCorrectedb,"OldEnergySigmaUnCorrected/F");
1363
1364
1365
1366 for (int i=0; i<nent; ++i) {
1367 eShowerTree->GetEntry(i);
1368
1369
1373 shower_EnergySigmaUnCorrectedb=-12345;
1374
1375
1376 ShowerTreeNew->Fill();
1377 }
1378 ShowerTreeNew->Write();
1379 fileNew->Close();
1380 fileOld->Close();
1381
1382
1383 gSystem->Exec("mv -vf Shower.root Shower.Orig.root");
1384 gSystem->Exec("mv -vf New.root Shower.root");
1385 cout << "EdbShowAlgE_Simple::WriteNewRootFile...done."<<endl;
1386 cout << "-------------------------------------------------------------------------------------------"<< endl<< endl;
1387 return;
1388}
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