Skip to content
Snippets Groups Projects
Commit 35fe4d75 authored by deserevi's avatar deserevi
Browse files

* Update Analysis.cc for Template and Gaspard analysis

* Add resolution of 30 keV (FWHM) for W1
parent 0e7d4d21
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
GeneralTarget
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Target
THICKNESS= 0.001
THICKNESS= 10
RADIUS= 7.5
MATERIAL= CD2
X= 0
......
......@@ -25,7 +25,7 @@ Target
ANGLE= 0
X= 0
Y= 0
Z= -50
Z= 0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AnnularS1
Z= -158.7
......
......@@ -8,7 +8,7 @@ Transfert
Light= 1H
Heavy= 133Sn
ExcitationEnergyLight= 0.0
ExcitationEnergyHeavy= 5.0
ExcitationEnergyHeavy= 0.0
BeamEnergy= 1320
BeamEnergySpread= 0
SigmaX= 0
......
......@@ -52,7 +52,7 @@ int main(int argc,char** argv)
GaspardTracker* GPDTrack = (GaspardTracker*) myDetector->m_Detector["GASPARD"];
// Get the input TChain and treat it
TChain* chain = RootInput:: getInstance() -> GetChain();
TChain* chain = RootInput:: getInstance()->GetChain();
// Connect TInitialConditions branch
TInitialConditions *initCond = 0;
......@@ -64,11 +64,6 @@ int main(int argc,char** argv)
chain->SetBranchAddress("InteractionCoordinates", &interCoord);
chain->SetBranchStatus("InteractionCoordinates", 0);
// Analysis is here!
int nentries = chain->GetEntries();
cout << "/////////// Loop information ///////////" << endl;
cout << "Number of entries to be analysed: " << nentries << endl;
// Default initialization
double XTarget = 0;
double YTarget = 0;
......@@ -78,9 +73,26 @@ int main(int argc,char** argv)
// random generator
TRandom3 *gene = new TRandom3();
// Get number of events to treat
cout << endl << "///////// Starting Analysis ///////// "<< endl;
int nentries = chain->GetEntries();
cout << " Number of Event to be treated : " << nentries << endl;
clock_t begin = clock();
clock_t end = begin;
// Loop on all events
for (int i = 0; i < nentries; i ++) {
if (i%10000 == 0 && i!=0) cout << "\r" << i << " analyzed events" << flush;
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;
// Get data
chain -> GetEntry(i);
// Treat Gaspard event
......
TTreeName
SimulatedTree
RootFileName
../../Outputs/Simulation/mySimul.root
../../Outputs/Simulation/myResult.root
......@@ -2,59 +2,69 @@
using namespace std;
int main(int argc,char** argv)
{
NPOptionManager* myOptionManager = NPOptionManager::getInstance(argc,argv) ;
string detectorfileName = myOptionManager->GetDetectorFilePath() ;
string reactionfileName = myOptionManager->GetCalibrationFilePath() ;
string calibrationfileName = myOptionManager->GetCalibrationFilePath() ;
string runToReadfileName = myOptionManager->GetRunToReadFilePath() ;
// First of All instantiate RootInput and Output
// Detector will be attached later
RootInput:: getInstance(runToReadfileName) ;
RootOutput::getInstance("Analysis/Template_AnalyzedData", "AnalyzedTree") ;
// Instantiate a Reaction
NPL::Reaction* myReaction = new Reaction ;
myReaction -> ReadConfigurationFile(reactionfileName) ;
// Instantiate the detector using a file
NPA::DetectorManager* myDetector = new DetectorManager ;
myDetector -> ReadConfigurationFile(detectorfileName) ;
// Instantiate the Calibration Manger using a file
CalibrationManager* myCalibration = CalibrationManager::getInstance(calibrationfileName) ;
// Get the formed Chained Tree and Treat it
TChain* Chain = RootInput:: getInstance() -> GetChain() ;
int i;
for ( i = 0 ; i < Chain -> GetEntries() ; i ++ )
{
if( i%10000 == 0 && i!=0) cout << "\r Event Analyzed:" << i << flush;
Chain -> GetEntry(i);
myDetector -> ClearEventPhysics() ;
myDetector -> BuildPhysicalEvent() ;
/************************************************
Put your code here
************************************************/
RootOutput::getInstance()->GetTree()->Fill() ;
}
cout << "A total of " << i << " event has been annalysed " << endl ;
RootOutput::getInstance()->Destroy();
return 0 ;
}
int main(int argc, char** argv)
{
// Parse command line
NPOptionManager* myOptionManager = NPOptionManager::getInstance(argc, argv);
string detectorfileName = myOptionManager->GetDetectorFile();
string reactionfileName = myOptionManager->GetCalibrationFile();
string calibrationfileName = myOptionManager->GetCalibrationFile();
string runToReadfileName = myOptionManager->GetRunToReadFile();
// First of All instantiate RootInput and Output
// Detector will be attached later
RootInput:: getInstance(runToReadfileName);
RootOutput::getInstance("Analysis/Template_AnalyzedData", "AnalyzedTree");
// Instantiate a Reaction
NPL::Reaction* myReaction = new Reaction();
myReaction->ReadConfigurationFile(reactionfileName);
// Instantiate the detector using a file
NPA::DetectorManager* myDetector = new DetectorManager();
myDetector->ReadConfigurationFile(detectorfileName);
// Instantiate the Calibration Manger using a file
CalibrationManager* myCalibration = CalibrationManager::getInstance(calibrationfileName);
// Get the formed Chained Tree and Treat it
TChain* Chain = RootInput:: getInstance() -> GetChain();
// Get number of events to treat
cout << endl << "///////// Starting Analysis ///////// "<< endl;
int nentries = Chain->GetEntries();
cout << " Number of Event to be treated : " << nentries << endl;
clock_t begin = clock();
clock_t end = begin;
// main loop on entries
for (int i = 0; i < nentries; i++) {
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;
double ThetaCalculation (TVector3 A , TVector3 B)
{
double Theta = acos( (A.Dot(B)) / (A.Mag()*B.Mag()) ) ;
return Theta ;
}
// get data
Chain -> GetEntry(i);
myDetector->ClearEventPhysics();
myDetector->BuildPhysicalEvent();
/************************************************
Put your code here
************************************************/
RootOutput::getInstance()->GetTree()->Fill();
}
cout << "A total of " << nentries << " event has been annalysed " << endl ;
RootOutput::getInstance()->Destroy();
return 0 ;
}
TTreeName
SimulatedTree
RootFileName
% ../../Outputs/Simulation/myResult.root
../../Outputs/Simulation/dummy.root
../../Outputs/Simulation/myResult.root
% ../../Outputs/Simulation/fe60dp_1mg.root
......@@ -151,9 +151,8 @@ private:
namespace W1SQUARE
{
// Energy/Time resolutions for the different layers
const G4double EnergyResolution = 0; // = 52keV of Resolution // Unit is MeV/2.35
// const G4double ResoFirstStage = 0.0106 ;// = 52keV of Resolution // Unit is MeV/2.35
const G4double TimeResolution = 0.638; // 1.5 ns (FWHM)
const G4double EnergyResolution = 12.8e-3; // 30 keV FWHM
const G4double TimeResolution = 0.638; // 1.5 ns (FWHM)
// Geometry
const G4double FaceFront = 50*mm;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment