From 9c9b940a9d9fd11ce0c6ad3fff651970d6e181ba Mon Sep 17 00:00:00 2001
From: deserevi <deserevi@nptool>
Date: Thu, 3 Feb 2011 09:20:38 +0000
Subject: [PATCH] * update Analysis.cc and ControlSimu.C

---
 Inputs/DetectorConfiguration/e530.detector |  2 +-
 Inputs/EventGenerator/60Fe.reaction        |  2 +-
 NPAnalysis/macros/ControlSimu.C            | 18 ++++++++++++++++--
 NPAnalysis/must2/RunToTreat.txt            |  3 ++-
 NPAnalysis/must2/src/Analysis.cc           |  2 +-
 5 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/Inputs/DetectorConfiguration/e530.detector b/Inputs/DetectorConfiguration/e530.detector
index c2afc6058..429498fbb 100644
--- a/Inputs/DetectorConfiguration/e530.detector
+++ b/Inputs/DetectorConfiguration/e530.detector
@@ -19,7 +19,7 @@
 GeneralTarget
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1
 Target
-	THICKNESS= 21.51
+	THICKNESS= 1.0755
 	RADIUS=	1.25
 	MATERIAL= CD2
 	ANGLE= 0
diff --git a/Inputs/EventGenerator/60Fe.reaction b/Inputs/EventGenerator/60Fe.reaction
index 92f87dfaa..37a54d261 100644
--- a/Inputs/EventGenerator/60Fe.reaction
+++ b/Inputs/EventGenerator/60Fe.reaction
@@ -10,7 +10,7 @@ Transfert
 	ExcitationEnergyHeavy= 0.0
 	ExcitationEnergyLight= 0.0
 	BeamEnergy= 1628.41
-	BeamEnergySpread= 0
+	BeamEnergySpread= 8.14
 	SigmaX= 0
 	SigmaY= 0
 	SigmaThetaX= 0 
diff --git a/NPAnalysis/macros/ControlSimu.C b/NPAnalysis/macros/ControlSimu.C
index 1f0ddf442..cbc92a913 100644
--- a/NPAnalysis/macros/ControlSimu.C
+++ b/NPAnalysis/macros/ControlSimu.C
@@ -48,6 +48,7 @@ void ControlSimu(const char * fname = "myResult")
    TString inFileName = fname;
    if (!inFileName.Contains("root")) inFileName += ".root";
    TFile *inFile = new TFile(path + inFileName);
+   if (!inFile->IsOpen()) exit(1);
    TTree *tree   = (TTree*) inFile->Get("SimulatedTree");
 
    // Connect the branches of the TTree and activate then if necessary
@@ -80,9 +81,22 @@ void ControlSimu(const char * fname = "myResult")
 
    // Read the TTree
    Int_t nentries = tree->GetEntries();
-   cout << "TTree contains " << nentries << " events" << endl;
+   cout <<endl << " TTree contains " << nentries << " events" << endl;
+   clock_t begin=clock();
+   clock_t end=begin;
    for (Int_t i = 0; i < nentries; i++) {
-      if (i%10000 == 0) cout << "Entry " << i << endl;
+      if (i%10000 == 0 && i!=0)  {
+         cout.precision(5);
+         end = clock();
+         double TimeElapsed = (end-begin) / CLOCKS_PER_SEC;
+         double percent = (double)i/nentries ;
+         double TimeToWait = (TimeElapsed/percent) - TimeElapsed;
+         cout  << "\r Progression:" << percent*100 << " % \t | \t Remaining time : ~" <<  TimeToWait <<"s"<< flush;
+      }
+      else if (i==nentries-1)  cout << "\r Progression:" << " 100% " <<endl;
+      
+//      if (i%10000 == 0) cout << "Entry " << i << endl;
+      // Get entry
       tree->GetEntry(i);
 
       // Fill histos
diff --git a/NPAnalysis/must2/RunToTreat.txt b/NPAnalysis/must2/RunToTreat.txt
index 698f27aa2..31a1ddd57 100644
--- a/NPAnalysis/must2/RunToTreat.txt
+++ b/NPAnalysis/must2/RunToTreat.txt
@@ -1,4 +1,5 @@
 TTreeName 
 	SimulatedTree
 RootFileName 
-	../../Outputs/Simulation/myResult.root
+%	../../Outputs/Simulation/myResult.root
+	../../Outputs/Simulation/fe60dp_100ug.root
diff --git a/NPAnalysis/must2/src/Analysis.cc b/NPAnalysis/must2/src/Analysis.cc
index 1cefa90e3..8e030f477 100644
--- a/NPAnalysis/must2/src/Analysis.cc
+++ b/NPAnalysis/must2/src/Analysis.cc
@@ -84,7 +84,7 @@ int main(int argc,char** argv)
    TH2F* Position_M2      = new TH2F("Must2Positions",     "Must2Positions",      2000, -200,   200, 2000, -200, 200);
    TH2F* Position_M2_tot  = new TH2F("Must2Positions_tot", "Must2Positions_tot",   130,   -1,   129,  130,   -1, 130);
       
-   cout <<  " ///////// Starting Analysis ///////// "<< endl << endl ;
+   cout << endl << "///////// Starting Analysis ///////// "<< endl;
    int N = Chain -> GetEntries(); 
    cout << " Number of Event to be treated : " << N << endl ;
    clock_t begin=clock();
-- 
GitLab