From 205ebbc5606caff83e3c6eb6752bc1e0e5ac15e2 Mon Sep 17 00:00:00 2001 From: deserevi <deserevi@nptool> Date: Thu, 14 Apr 2011 09:08:29 +0000 Subject: [PATCH] + Add support for Exogam, Vamos and Ionisation chamber (CHIO) in NPLib --- NPLib/Chio/Makefile | 56 +++ NPLib/Chio/TChio_anData.cxx | 48 +++ NPLib/Chio/TChio_anData.h | 38 ++ NPLib/Chio/TChio_anPhysics.cxx | 414 ++++++++++++++++++ NPLib/Chio/TChio_anPhysics.h | 135 ++++++ NPLib/Chio/TChio_digData.cxx | 47 +++ NPLib/Chio/TChio_digData.h | 42 ++ NPLib/Chio/TChio_digPhysics.cxx | 430 +++++++++++++++++++ NPLib/Chio/TChio_digPhysics.h | 135 ++++++ NPLib/Exogam/Makefile | 42 ++ NPLib/Exogam/TExogamData.cxx | 100 +++++ NPLib/Exogam/TExogamData.h | 116 +++++ NPLib/Exogam/TExogamPhysics.cxx | 676 ++++++++++++++++++++++++++++++ NPLib/Exogam/TExogamPhysics.h | 170 ++++++++ NPLib/Makefile | 2 +- NPLib/Plastic/TPlasticPhysics.h | 14 +- NPLib/Vamos/Makefile | 58 +++ NPLib/Vamos/TVamosCHIOData.cxx | 75 ++++ NPLib/Vamos/TVamosCHIOData.h | 82 ++++ NPLib/Vamos/TVamosDCData.cxx | 94 +++++ NPLib/Vamos/TVamosDCData.h | 115 +++++ NPLib/Vamos/TVamosFingerData.cxx | 58 +++ NPLib/Vamos/TVamosFingerData.h | 55 +++ NPLib/Vamos/TVamosPlasticData.cxx | 62 +++ NPLib/Vamos/TVamosPlasticData.h | 61 +++ 25 files changed, 3117 insertions(+), 8 deletions(-) create mode 100644 NPLib/Chio/Makefile create mode 100644 NPLib/Chio/TChio_anData.cxx create mode 100644 NPLib/Chio/TChio_anData.h create mode 100644 NPLib/Chio/TChio_anPhysics.cxx create mode 100644 NPLib/Chio/TChio_anPhysics.h create mode 100644 NPLib/Chio/TChio_digData.cxx create mode 100644 NPLib/Chio/TChio_digData.h create mode 100644 NPLib/Chio/TChio_digPhysics.cxx create mode 100644 NPLib/Chio/TChio_digPhysics.h create mode 100644 NPLib/Exogam/Makefile create mode 100644 NPLib/Exogam/TExogamData.cxx create mode 100644 NPLib/Exogam/TExogamData.h create mode 100644 NPLib/Exogam/TExogamPhysics.cxx create mode 100644 NPLib/Exogam/TExogamPhysics.h create mode 100644 NPLib/Vamos/Makefile create mode 100644 NPLib/Vamos/TVamosCHIOData.cxx create mode 100644 NPLib/Vamos/TVamosCHIOData.h create mode 100644 NPLib/Vamos/TVamosDCData.cxx create mode 100644 NPLib/Vamos/TVamosDCData.h create mode 100644 NPLib/Vamos/TVamosFingerData.cxx create mode 100644 NPLib/Vamos/TVamosFingerData.h create mode 100644 NPLib/Vamos/TVamosPlasticData.cxx create mode 100644 NPLib/Vamos/TVamosPlasticData.h diff --git a/NPLib/Chio/Makefile b/NPLib/Chio/Makefile new file mode 100644 index 000000000..75f9f1d01 --- /dev/null +++ b/NPLib/Chio/Makefile @@ -0,0 +1,56 @@ +include ../Makefile.arch + +#------------------------------------------------------------------------------ +SHARELIB = libChio_anData.so libChio_digData.so libChio_anPhysics.so libChio_digPhysics.so + +all: $(SHARELIB) +#------------------------------------------------------------------------------ +############### Detector ############## + +## Chio_an & Chio_dig ## +libChio_anData.so: TChio_anData.o TChio_anDataDict.o + $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ + +TChio_anDataDict.cxx: TChio_anData.h + rootcint -f $@ -c $^ + +libChio_anPhysics.so: TChio_anPhysics.o TChio_anPhysicsDict.o + $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ + +TChio_anPhysicsDict.cxx: TChio_anPhysics.h + rootcint -f $@ -c $^ + +libChio_digData.so: TChio_digData.o TChio_digDataDict.o + $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ + +TChio_digDataDict.cxx: TChio_digData.h + rootcint -f $@ -c $^ + +libChio_digPhysics.so: TChio_digPhysics.o TChio_digPhysicsDict.o + $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ + +TChio_digPhysicsDict.cxx: TChio_digPhysics.h + rootcint -f $@ -c $^ + +# dependences +TChio_anData.o: TChio_anData.cxx TChio_anData.h +TChio_digData.o: TChio_digData.cxx TChio_digData.h +TChio_anPhysics.o: TChio_anPhysics.cxx TChio_anPhysics.h +TChio_digPhysics.o: TChio_digPhysics.cxx TChio_digPhysics.h +####################################### + +############# Clean and More ########## +clean: + @rm -f core *~ *.o *Dict* + +distclean: + make clean; rm -f *.so + +.SUFFIXES: .$(SrcSuf) + +### + +.$(SrcSuf).$(ObjSuf): + $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< + + diff --git a/NPLib/Chio/TChio_anData.cxx b/NPLib/Chio/TChio_anData.cxx new file mode 100644 index 000000000..7ba5bb6b7 --- /dev/null +++ b/NPLib/Chio/TChio_anData.cxx @@ -0,0 +1,48 @@ +#include <iostream> +using namespace std; + +#include "TChio_anData.h" + + +ClassImp(TChio_anData) + +TChio_anData::TChio_anData() +{ + // Default constructor + + // (E) + fChio_an_Energy.clear(); + fChio_an_Energy_pileup.clear(); +} + + + +TChio_anData::~TChio_anData() +{ +} + + + +void TChio_anData::Clear() +{ + // (E) + fChio_an_Energy.clear(); + fChio_an_Energy_pileup.clear(); +} + + + +void TChio_anData::Dump() const +{ + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; + + // Chio_an + // (E) + cout << "Chio_an_MultE = " << fChio_an_Energy.size() << endl; + for (UShort_t i = 0; i < fChio_an_Energy.size(); i++) + cout << " Energy: " << fChio_an_Energy[i] << endl; + + cout << "Chio_an_MultE pileup = " << fChio_an_Energy_pileup.size() << endl; + for (UShort_t i = 0; i < fChio_an_Energy_pileup.size(); i++) + cout << " Energy: " << fChio_an_Energy_pileup[i] << endl; +} diff --git a/NPLib/Chio/TChio_anData.h b/NPLib/Chio/TChio_anData.h new file mode 100644 index 000000000..1350a3c4b --- /dev/null +++ b/NPLib/Chio/TChio_anData.h @@ -0,0 +1,38 @@ +#ifndef __CHIO_ANDATA__ +#define __CHIO_ANDATA__ + +#include <vector> +#include "TObject.h" +using namespace std; + + +class TChio_anData : public TObject { + private: + // ADC + vector<UShort_t> fChio_an_Energy; + vector<UShort_t> fChio_an_Energy_pileup; + + public: + TChio_anData(); + virtual ~TChio_anData(); + + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + ///////////////////// GETTERS //////////////////////// + // (E) + UShort_t GetMultE() {return fChio_an_Energy.size();} + UShort_t GetEnergy(Int_t i) {return fChio_an_Energy.at(i);} + UShort_t GetMultE_pileup() {return fChio_an_Energy_pileup.size();} + UShort_t GetEnergy_pileup(Int_t i) {return fChio_an_Energy_pileup.at(i);} + + ///////////////////// SETTERS //////////////////////// + // (E) + void SetEnergy(UShort_t E) {fChio_an_Energy.push_back(E);} + void SetEnergy_pileup(UShort_t E) {fChio_an_Energy_pileup.push_back(E);} + + ClassDef(TChio_anData,1) // Chio_anData structure +}; + +#endif diff --git a/NPLib/Chio/TChio_anPhysics.cxx b/NPLib/Chio/TChio_anPhysics.cxx new file mode 100644 index 000000000..2b96e1b7a --- /dev/null +++ b/NPLib/Chio/TChio_anPhysics.cxx @@ -0,0 +1,414 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Sandra Giron contact address: giron@ipno.in2p3.fr * + * * + * Creation Date : febuary 2011 * + * Last update : March 2011 by megumi * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold chio treated data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + *****************************************************************************/ + + +#include "TChio_anPhysics.h" +using namespace LOCAL_CHIO; + +// STL +#include <cmath> +#include <algorithm> +#include <sstream> +#include <fstream> +#include <iostream> +#include <stdlib.h> + +// NPL +#include "RootInput.h" +#include "RootOutput.h" + +// ROOT +#include "TChain.h" +#include "TRandom.h" + +ClassImp(TChio_anPhysics) +/////////////////////////////////////////////////////////////////////////// +TChio_anPhysics::TChio_anPhysics() +{ + EventData = new TChio_anData(); + EventPhysics = this; + fdecay = new TF1("fdecay","-[0]*exp(-x/[1])"); +} + + + +TChio_anPhysics::~TChio_anPhysics() +{ +} + + + +// Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token +void TChio_anPhysics::ReadConfiguration(string Path) +{ + ifstream ConfigFile; + ConfigFile.open(Path.c_str()); + string LineBuffer ; + string DataBuffer ; + + double Ax , Bx , Cx , Dx , Ay , By , Cy , Dy , Az , Bz , Cz , Dz ; + TVector3 A , B , C , D ; + + bool check_A = false ; + bool check_B = false ; + bool check_C = false ; + bool check_D = false ; + + bool ReadingStatus = false ; + + while (!ConfigFile.eof()) { + getline(ConfigFile, LineBuffer); + + //If line is a Start Up chio bloc, Reading toggle to true + if (LineBuffer.compare(0, 4, "Chio") == 0) { + cout << "///" << endl ; + cout << "Chio Detector found: " << endl ; + ReadingStatus = true ; + } + + // Else don't toggle to Reading Block Status + else ReadingStatus = false ; + + // Reading Block + while (ReadingStatus) { + ConfigFile >> DataBuffer ; + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) { + ConfigFile.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); + } + + // Finding another telescope (safety), toggle out + else if (DataBuffer.compare(0, 4, "Chio") == 0) { + cout << "WARNING: Another chio is found before standard sequence of Token, Error may have occured in chio definition" << endl ; + ReadingStatus = false ; + } + + // Corner Position method + + else if (DataBuffer.compare(0, 2, "A=") == 0) { + check_A = true; + ConfigFile >> DataBuffer ; + Ax = atof(DataBuffer.c_str()) ; + Ax = Ax ; + ConfigFile >> DataBuffer ; + Ay = atof(DataBuffer.c_str()) ; + Ay = Ay ; + ConfigFile >> DataBuffer ; + Az = atof(DataBuffer.c_str()) ; + Az = Az ; + + A = TVector3(Ax, Ay, Az); + cout << "A corner position : (" << A.X() << ";" << A.Y() << ";" << A.Z() << ")" << endl; + } + + else if (DataBuffer.compare(0, 2, "B=") == 0) { + check_B = true; + ConfigFile >> DataBuffer ; + Bx = atof(DataBuffer.c_str()) ; + Bx = Bx ; + ConfigFile >> DataBuffer ; + By = atof(DataBuffer.c_str()) ; + By = By ; + ConfigFile >> DataBuffer ; + Bz = atof(DataBuffer.c_str()) ; + Bz = Bz ; + + B = TVector3(Bx, By, Bz); + cout << "B corner position : (" << B.X() << ";" << B.Y() << ";" << B.Z() << ")" << endl; + } + + else if (DataBuffer.compare(0, 2, "C=") == 0) { + check_C = true; + ConfigFile >> DataBuffer ; + Cx = atof(DataBuffer.c_str()) ; + Cx = Cx ; + ConfigFile >> DataBuffer ; + Cy = atof(DataBuffer.c_str()) ; + Cy = Cy ; + ConfigFile >> DataBuffer ; + Cz = atof(DataBuffer.c_str()) ; + Cz = Cz ; + + C = TVector3(Cx, Cy, Cz); + cout << "C corner position : (" << C.X() << ";" << C.Y() << ";" << C.Z() << ")" << endl; + } + + else if (DataBuffer.compare(0, 2, "D=") == 0) { + check_D = true; + ConfigFile >> DataBuffer ; + Dx = atof(DataBuffer.c_str()) ; + Dx = Dx ; + ConfigFile >> DataBuffer ; + Dy = atof(DataBuffer.c_str()) ; + Dy = Dy ; + ConfigFile >> DataBuffer ; + Dz = atof(DataBuffer.c_str()) ; + Dz = Dz ; + + D = TVector3(Dx, Dy, Dz); + cout << "D corner position : (" << D.X() << ";" << D.Y() << ";" << D.Z() << ")" << endl; + + } + + // End Corner Position Method + + ///////////////////////////////////////////////// + // If All necessary information there, toggle out + if (check_A && check_B && check_C && check_D) { + ReadingStatus = false; + + ///Add The previously define telescope + + // AddChio( A , + // B , + // C , + // D ); + + check_A = false; + check_B = false; + check_C = false; + check_D = false; + } + } + + } + + cout << endl << "/////////////////////////////" << endl << endl; +} + + + +// Add Parameter to the CalibrationManger +void TChio_anPhysics::AddParameterToCalibrationManager() +{ + CalibrationManager* Cal = CalibrationManager::getInstance(); + + Cal->AddParameter("CHIO", "AN_AMPLITUDE", "CHIO_AN_AMPLITUDE"); +} + + + +// Activated associated Branches and link it to the private member DetectorData address +// In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated +void TChio_anPhysics::InitializeRootInputRaw() +{ + TChain* inputChain = RootInput::getInstance()->GetChain() ; + inputChain->SetBranchStatus("CHIO_AN" , true) ; + inputChain->SetBranchStatus("fChio_an_*" , true) ; + inputChain->SetBranchAddress("CHIO_AN" , &EventData) ; +} + +// Activated associated Branches and link it to the private member DetectorPhysics address +// In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated +void TChio_anPhysics::InitializeRootInputPhysics() +{ + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus("CHIO_AN" , true); + // inputChain->SetBranchStatus("Ampl" , true); + // inputChain->SetBranchStatus("Ampl_sscorr" , true); + // inputChain->SetBranchStatus("Sum" , true); + // inputChain->SetBranchStatus("Sum_sscorr" , true); + // inputChain->SetBranchStatus("Peak" , true); + // inputChain->SetBranchStatus("Peak_base" , true); + // inputChain->SetBranchStatus("Peak_dist" , true); + // inputChain->SetBranchStatus("Peak_stop" , true); + // inputChain->SetBranchStatus("PileupNbr" , true); + inputChain->SetBranchStatus("Npileup" , true); + inputChain->SetBranchStatus("peak_start" , true); + inputChain->SetBranchStatus("peak_stop" , true); + inputChain->SetBranchStatus("risetime" , true); + inputChain->SetBranchStatus("rawAmplitude" , true); + inputChain->SetBranchStatus("calAmplitude" , true); + inputChain->SetBranchStatus("Energy" , true); + inputChain->SetBranchAddress("CHIO_AN" , &EventPhysics); + +} + + + +// Create associated branches and associated private member DetectorPhysics address +void TChio_anPhysics::InitializeRootOutput() +{ + TTree* outputTree = RootOutput::getInstance()->GetTree(); + outputTree->Branch("CHIO_AN" , "TChio_anPhysics" , &EventPhysics); +} + + + +void TChio_anPhysics::Clear() +{ + // --- variables used in Jo's program + // Ampl.clear(); + // Ampl_sscorr.clear(); + // Sum.clear(); + // Sum_sscorr.clear(); + // Peak.clear(); + // Peak_base.clear(); + // Peak_dist.clear(); + // Peak_stop.clear(); + // for(int i=0;i<350;i++) + // Energy[i]=0; + Energy.clear(); + // PileupNbr = 0; + + // -- modified by megumi + Npileup = 0; + peak_start.clear(); + peak_stop.clear(); + risetime.clear(); + rawAmplitude.clear(); + calAmplitude.clear(); +} + + + +void TChio_anPhysics::Dump() const +{ + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; + + // cout << "Number of pileup : " << PileupNbr << endl; + + // for (unsigned int i = 0; i < Ampl.size() ; i++) { + // cout << "Amplitude : " << Ampl.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Ampl_sscorr.size() ; i++) { + // cout << "Amplitude w/o correction : " << Ampl_sscorr.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Sum.size() ; i++) { + // cout << "Sum : " << Sum.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Sum_sscorr.size() ; i++) { + // cout << "Sum w/o correction : " << Sum_sscorr.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Peak.size() ; i++) { + // cout << "Peak position : " << Peak.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Peak_base.size() ; i++) { + // cout << "Peak base : " << Peak_base.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Peak_dist.size() ; i++) { + // cout << "Peak distance : " << Peak_dist.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Peak_stop.size() ; i++) { + // cout << "Peak stop : " << Peak_stop.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Energy.size() ; i++) { + // cout << "Energy : " << Energy.at(i) << endl; + // } +} + +// This method is called at each event read from the Input Tree. Aim is to build treat Raw dat in order to extract physical parameter +void TChio_anPhysics::BuildPhysicalEvent() +{ + BuildSimplePhysicalEvent(); +} + + +// Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorithm but less efficient ...). +// This method aimed to be used for analysis performed during experiment, when speed is requiered. +void TChio_anPhysics::BuildSimplePhysicalEvent() +{ + // put here corresponding code of TChio_digCal. + + // // ======================================================== + // // from here --- modified by megumi + /* + // set variables + Int_t Nch = EventData->GetEsize(); // number of channels + + // define variables + Int_t threshold = 7; + Int_t Toffset = 4; + Double_t decay_t = 1400.0/25.; // decay time of pre-Amp (ns)/25ns = ch + + // read digitizer data into "Energy" + for(int ch=0;ch<Nch;ch++){ + Energy.push_back((double)EventData->GetEnergy(ch)); + // Energy[ch] = (int)EventData->GetEnergy(ch); + // cout << EventData->GetEnergy(ch) << endl; + } + + if(Nch!=0){ + int ch = 0; + while(ch<Nch-1){ + if(Energy[ch]-Energy[ch+1]>threshold){ + peak_start.push_back(ch-Toffset); + while(Energy[ch]-Energy[ch+1]>0){ + ch++; + } + peak_stop.push_back(ch); + risetime.push_back(peak_stop[Npileup] - peak_start[Npileup]); + Npileup++; + } + ch++; + } + + // deduce amplitude + // -- define decay function + + fdecay->SetParLimits(0,0,10000); // only positive limitation + fdecay->FixParameter(1,decay_t); // all peaks should have same decay time -> fixed + + + for(int pid=0;pid<Npileup;pid++){ + // base line estimation + Int_t fit_debut; // begining channel of fit + Int_t fit_fin; // end channel of fit + // -- base line range + if(pid==0) fit_debut = max((int)peak_start[pid]-20,0); + else fit_debut = max((int)peak_start[pid]-20,(int)peak_stop[pid-1]); + fit_fin = peak_start[pid]; + // -- base line data + TGraph *gra_base = new TGraph(); + int tmpi = 0; + for(ch=fit_debut;ch<fit_fin;ch++){ + gra_base->SetPoint(tmpi,ch,Energy[ch]); + tmpi++; + } + if(fit_debut<fit_fin){ + // -- base line fit + fdecay->SetRange(fit_debut,fit_fin); + gra_base->Fit("fdecay","rq"); + // deduce amplitude + rawAmplitude.push_back(Energy[peak_stop[pid]]-fdecay->Eval(peak_stop[pid])); + // calibration + calAmplitude.push_back(CalibRawAmplitude(rawAmplitude[pid])); + } + } + } + */ +} + +namespace LOCAL_CHIO +{ + double CalibRawAmplitude(const double rawAmplitude) + { + return CalibrationManager::getInstance()->ApplyCalibration("CHIO/CHIO_AN_AMPLITUDE", rawAmplitude); + } +} diff --git a/NPLib/Chio/TChio_anPhysics.h b/NPLib/Chio/TChio_anPhysics.h new file mode 100644 index 000000000..9cb2b8d8b --- /dev/null +++ b/NPLib/Chio/TChio_anPhysics.h @@ -0,0 +1,135 @@ +#ifndef __CHIOANCAL__ +#define __CHIOANCAL__ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Sandra Giron contact address: giron@ipno.in2p3.fr * + * * + * Creation Date : febuary 2011 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold chio treated data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + *****************************************************************************/ + +// STL +#include <vector> +#include <algorithm> + +// ROOT +#include "TObject.h" +#include "TVector3.h" +#include "TGraph.h" +#include "TF1.h" + +// NPLib +#include "TChio_anData.h" +#include "../include/VDetector.h" +#include "../include/CalibrationManager.h" + +using namespace std ; + +class TChio_anPhysics : public TObject, public NPA::VDetector +{ + + public: // Constructor and Destructor + TChio_anPhysics(); + ~TChio_anPhysics(); + + private: // Output data of interest + + ///// this is private in TChio_digCal.h but public in TPlasticPhysics.h...?? + + // ADC + vector<double> Energy; + /* Double_t Energy[350]; */ + //sum + // --- used in Ionization chamber + /* vector<double> Sum; */ + /* vector<double> Ampl; */ + /* vector<double> Sum_sscorr; */ + /* vector<double> Ampl_sscorr; */ + /* vector<short> Peak; */ + /* vector<double> Peak_dist; */ + /* vector<short> Peak_stop; */ + /* vector<double> Peak_base; */ + /* int PileupNbr; */ + // --- modified by megumi + int Npileup; // number of pileup + + vector<int> peak_start; // start of peak + vector<int> peak_stop; // top of peak + vector<int> risetime; + vector<double> rawAmplitude; + vector<double> calAmplitude; + + TF1 *fdecay; + + private: // Root Input and Output tree classes + + /* TChio_digData* EventData;//! */ + TChio_anData* EventData;//! + TChio_anPhysics* EventPhysics;//! + + public: // Inherited from VDetector Class + + // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token + void ReadConfiguration(string); + + // Add Parameter to the CalibrationManger + void AddParameterToCalibrationManager(); + + // Activated associated Branches and link it to the private member DetectorData address + // In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated + void InitializeRootInputRaw() ; + + // Activated associated Branches and link it to the private member DetectorPhysics address + // In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated + void InitializeRootInputPhysics() ; + + // Create associated branches and associated private member DetectorPhysics address + void InitializeRootOutput() ; + + // This method is called at each event read from the Input Tree. Aim is to build treat Raw dat in order to extract physical parameter. + void BuildPhysicalEvent(); + + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). + // This method aimed to be used for analysis performed during experiment, when speed is requiered. + // NB: This method can eventually be the same as BuildPhysicalEvent. + void BuildSimplePhysicalEvent(); + + // Those two method all to clear the Event Physics or Data + void ClearEventPhysics() {Clear();} + void ClearEventData() {EventData->Clear();} + + public : // Specific to ionisation chamber + + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + // Give and external TMustChio_anData object to TChio_anPhysics. Needed for online analysis. + void SetRawDataPointer(TChio_anData* rawDataPointer) {EventData = rawDataPointer;} + + + // double GetChioEnergy() {return ...} + + ClassDef(TChio_anPhysics,1); // CATSPhysics structure + +}; + + +namespace LOCAL_CHIO +{ + double CalibRawAmplitude(double); +} + +#endif diff --git a/NPLib/Chio/TChio_digData.cxx b/NPLib/Chio/TChio_digData.cxx new file mode 100644 index 000000000..f43f6ea12 --- /dev/null +++ b/NPLib/Chio/TChio_digData.cxx @@ -0,0 +1,47 @@ +#include <iostream> +using namespace std; + +#include "TChio_digData.h" + + +ClassImp(TChio_digData) + +TChio_digData::TChio_digData() +{ + // Default constructor + + // (E) + fChio_dig_Energy.clear(); + //sum + fChio_dig_Sum = 0; +} + + + +TChio_digData::~TChio_digData() +{ +} + + + +void TChio_digData::Clear() +{ + // (E) + fChio_dig_Energy.clear(); + //sum + fChio_dig_Sum = 0; +} + + + +void TChio_digData::Dump() const +{ + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; + + // (E) + cout << "Chio_dig_Esize = " << fChio_dig_Energy.size() << endl; + for (UShort_t i = 0; i < fChio_dig_Energy.size(); i++) + cout << " Energy: " << fChio_dig_Energy[i] << endl; + //sum + cout<<"Chio_dig_sum" << fChio_dig_Sum << endl; +} diff --git a/NPLib/Chio/TChio_digData.h b/NPLib/Chio/TChio_digData.h new file mode 100644 index 000000000..3c1069acc --- /dev/null +++ b/NPLib/Chio/TChio_digData.h @@ -0,0 +1,42 @@ +#ifndef __CHIO_DIGDATA__ +#define __CHIO_DIGDATA__ + +#include <vector> +#include "TObject.h" +using namespace std; + + +class TChio_digData : public TObject { + private: + // ADC + vector<UShort_t> fChio_dig_Energy; + + //sum + Int_t fChio_dig_Sum; + + public: + TChio_digData(); + virtual ~TChio_digData(); + + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + ///////////////////// GETTERS //////////////////////// + // (E) + UShort_t GetEsize() {return fChio_dig_Energy.size();} + UShort_t GetEnergy(Int_t i) {return fChio_dig_Energy.at(i);} + + //sum + Int_t GetSum() {return fChio_dig_Sum;} + + ///////////////////// SETTERS //////////////////////// + //sum + void SetSum(UShort_t E) {fChio_dig_Sum += (Int_t)E;} + // (E) + void SetEnergy(UShort_t E) {fChio_dig_Energy.push_back(E);} + + ClassDef(TChio_digData,1) // Chio_digData structure +}; + +#endif diff --git a/NPLib/Chio/TChio_digPhysics.cxx b/NPLib/Chio/TChio_digPhysics.cxx new file mode 100644 index 000000000..970698fb3 --- /dev/null +++ b/NPLib/Chio/TChio_digPhysics.cxx @@ -0,0 +1,430 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Sandra Giron contact address: giron@ipno.in2p3.fr * + * * + * Creation Date : febuary 2011 * + * Last update : March 2011 by megumi * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold chio treated data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + *****************************************************************************/ + + +#include "TChio_digPhysics.h" +using namespace LOCAL_CHIO; + +// STL +#include <cmath> +#include <algorithm> +#include <sstream> +#include <fstream> +#include <iostream> +#include <stdlib.h> + +// NPL +#include "RootInput.h" +#include "RootOutput.h" + +// ROOT +#include "TChain.h" +#include "TRandom.h" + +ClassImp(TChio_digPhysics) +/////////////////////////////////////////////////////////////////////////// +TChio_digPhysics::TChio_digPhysics() +{ + EventData = new TChio_digData(); + EventPhysics = this; + fdecay = new TF1("fdecay","-[0]*exp(-x/[1])+[2]"); +} + + + +TChio_digPhysics::~TChio_digPhysics() +{ +} + + + +// Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token +void TChio_digPhysics::ReadConfiguration(string Path) +{ + ifstream ConfigFile; + ConfigFile.open(Path.c_str()); + string LineBuffer ; + string DataBuffer ; + + double Ax , Bx , Cx , Dx , Ay , By , Cy , Dy , Az , Bz , Cz , Dz ; + TVector3 A , B , C , D ; + + bool check_A = false ; + bool check_B = false ; + bool check_C = false ; + bool check_D = false ; + + bool ReadingStatus = false ; + + while (!ConfigFile.eof()) { + getline(ConfigFile, LineBuffer); + + //If line is a Start Up chio bloc, Reading toggle to true + if (LineBuffer.compare(0, 4, "Chio") == 0) { + cout << "///" << endl ; + cout << "Chio Detector found: " << endl ; + ReadingStatus = true ; + } + + // Else don't toggle to Reading Block Status + else ReadingStatus = false ; + + // Reading Block + while (ReadingStatus) { + ConfigFile >> DataBuffer ; + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) { + ConfigFile.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); + } + + // Finding another telescope (safety), toggle out + else if (DataBuffer.compare(0, 4, "Chio") == 0) { + cout << "WARNING: Another chio is found before standard sequence of Token, Error may have occured in chio definition" << endl ; + ReadingStatus = false ; + } + + // Corner Position method + + else if (DataBuffer.compare(0, 2, "A=") == 0) { + check_A = true; + ConfigFile >> DataBuffer ; + Ax = atof(DataBuffer.c_str()) ; + Ax = Ax ; + ConfigFile >> DataBuffer ; + Ay = atof(DataBuffer.c_str()) ; + Ay = Ay ; + ConfigFile >> DataBuffer ; + Az = atof(DataBuffer.c_str()) ; + Az = Az ; + + A = TVector3(Ax, Ay, Az); + cout << "A corner position : (" << A.X() << ";" << A.Y() << ";" << A.Z() << ")" << endl; + } + + else if (DataBuffer.compare(0, 2, "B=") == 0) { + check_B = true; + ConfigFile >> DataBuffer ; + Bx = atof(DataBuffer.c_str()) ; + Bx = Bx ; + ConfigFile >> DataBuffer ; + By = atof(DataBuffer.c_str()) ; + By = By ; + ConfigFile >> DataBuffer ; + Bz = atof(DataBuffer.c_str()) ; + Bz = Bz ; + + B = TVector3(Bx, By, Bz); + cout << "B corner position : (" << B.X() << ";" << B.Y() << ";" << B.Z() << ")" << endl; + } + + else if (DataBuffer.compare(0, 2, "C=") == 0) { + check_C = true; + ConfigFile >> DataBuffer ; + Cx = atof(DataBuffer.c_str()) ; + Cx = Cx ; + ConfigFile >> DataBuffer ; + Cy = atof(DataBuffer.c_str()) ; + Cy = Cy ; + ConfigFile >> DataBuffer ; + Cz = atof(DataBuffer.c_str()) ; + Cz = Cz ; + + C = TVector3(Cx, Cy, Cz); + cout << "C corner position : (" << C.X() << ";" << C.Y() << ";" << C.Z() << ")" << endl; + } + + else if (DataBuffer.compare(0, 2, "D=") == 0) { + check_D = true; + ConfigFile >> DataBuffer ; + Dx = atof(DataBuffer.c_str()) ; + Dx = Dx ; + ConfigFile >> DataBuffer ; + Dy = atof(DataBuffer.c_str()) ; + Dy = Dy ; + ConfigFile >> DataBuffer ; + Dz = atof(DataBuffer.c_str()) ; + Dz = Dz ; + + D = TVector3(Dx, Dy, Dz); + cout << "D corner position : (" << D.X() << ";" << D.Y() << ";" << D.Z() << ")" << endl; + + } + + // End Corner Position Method + + ///////////////////////////////////////////////// + // If All necessary information there, toggle out + if (check_A && check_B && check_C && check_D) { + ReadingStatus = false; + + ///Add The previously define telescope + + // AddChio( A , + // B , + // C , + // D ); + + check_A = false; + check_B = false; + check_C = false; + check_D = false; + } + } + + } + + cout << endl << "/////////////////////////////" << endl << endl; +} + + + +// Add Parameter to the CalibrationManger +void TChio_digPhysics::AddParameterToCalibrationManager() +{ + CalibrationManager* Cal = CalibrationManager::getInstance(); + + Cal->AddParameter("CHIO", "DIG_AMPLITUDE", "CHIO_DIG_AMPLITUDE"); +} + + + +// Activated associated Branches and link it to the private member DetectorData address +// In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated +void TChio_digPhysics::InitializeRootInputRaw() +{ + TChain* inputChain = RootInput::getInstance()->GetChain() ; + inputChain->SetBranchStatus("CHIO_DIG" , true) ; + inputChain->SetBranchStatus("fChio_dig_*" , true) ; + inputChain->SetBranchAddress("CHIO_DIG" , &EventData) ; +} + +// Activated associated Branches and link it to the private member DetectorPhysics address +// In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated +void TChio_digPhysics::InitializeRootInputPhysics() +{ + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus("CHIO_DIG" , true); + // inputChain->SetBranchStatus("Ampl" , true); + // inputChain->SetBranchStatus("Ampl_sscorr" , true); + // inputChain->SetBranchStatus("Sum" , true); + // inputChain->SetBranchStatus("Sum_sscorr" , true); + // inputChain->SetBranchStatus("Peak" , true); + // inputChain->SetBranchStatus("Peak_base" , true); + // inputChain->SetBranchStatus("Peak_dist" , true); + // inputChain->SetBranchStatus("Peak_stop" , true); + // inputChain->SetBranchStatus("PileupNbr" , true); + inputChain->SetBranchStatus("Npileup" , true); + inputChain->SetBranchStatus("peak_start" , true); + inputChain->SetBranchStatus("peak_stop" , true); + inputChain->SetBranchStatus("risetime" , true); + inputChain->SetBranchStatus("rawAmplitude" , true); + inputChain->SetBranchStatus("calAmplitude" , true); + inputChain->SetBranchStatus("Energy" , true); + inputChain->SetBranchAddress("CHIO_DIG" , &EventPhysics); + +} + + + +// Create associated branches and associated private member DetectorPhysics address +void TChio_digPhysics::InitializeRootOutput() +{ + TTree* outputTree = RootOutput::getInstance()->GetTree(); + outputTree->Branch("CHIO_DIG" , "TChio_digPhysics" , &EventPhysics); +} + + + +void TChio_digPhysics::Clear() +{ + // --- variables used in Jo's program + // Ampl.clear(); + // Ampl_sscorr.clear(); + // Sum.clear(); + // Sum_sscorr.clear(); + // Peak.clear(); + // Peak_base.clear(); + // Peak_dist.clear(); + // Peak_stop.clear(); + // for(int i=0;i<350;i++) + // Energy[i]=0; + Energy.clear(); + // PileupNbr = 0; + + // -- modified by megumi + Npileup = 0; + peak_start.clear(); + peak_stop.clear(); + risetime.clear(); + rawAmplitude.clear(); + calAmplitude.clear(); +} + + + +void TChio_digPhysics::Dump() const +{ + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; + + // cout << "Number of pileup : " << PileupNbr << endl; + + // for (unsigned int i = 0; i < Ampl.size() ; i++) { + // cout << "Amplitude : " << Ampl.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Ampl_sscorr.size() ; i++) { + // cout << "Amplitude w/o correction : " << Ampl_sscorr.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Sum.size() ; i++) { + // cout << "Sum : " << Sum.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Sum_sscorr.size() ; i++) { + // cout << "Sum w/o correction : " << Sum_sscorr.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Peak.size() ; i++) { + // cout << "Peak position : " << Peak.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Peak_base.size() ; i++) { + // cout << "Peak base : " << Peak_base.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Peak_dist.size() ; i++) { + // cout << "Peak distance : " << Peak_dist.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Peak_stop.size() ; i++) { + // cout << "Peak stop : " << Peak_stop.at(i) << endl; + // } + + // for (unsigned int i = 0; i < Energy.size() ; i++) { + // cout << "Energy : " << Energy.at(i) << endl; + // } +} + +// This method is called at each event read from the Input Tree. Aim is to build treat Raw dat in order to extract physical parameter +void TChio_digPhysics::BuildPhysicalEvent() +{ + BuildSimplePhysicalEvent(); +} + + +// Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorithm but less efficient ...). +// This method aimed to be used for analysis performed during experiment, when speed is requiered. +void TChio_digPhysics::BuildSimplePhysicalEvent() +{ + // put here corresponding code of TChio_digCal. + + // // ======================================================== + // // from here --- modified by megumi + + // set variables + Int_t Nch = EventData->GetEsize(); // number of channels + + // define variables + Int_t threshold = 7; + Int_t Toffset = 4; + Double_t decay_t = 1600.0/25.; // decay time of pre-Amp (ns)/25ns = ch + // this value is defined by RC cuircuit in pre-amplifier. + // ask technitian for R and C values + + // read digitizer data into "Energy" + for(int ch=0;ch<Nch;ch++){ + Energy.push_back((double)EventData->GetEnergy(ch)); + // Energy[ch] = (int)EventData->GetEnergy(ch); + // cout << EventData->GetEnergy(ch) << endl; + } + + if(Nch!=0){ + int ch = 0; + while(ch<Nch-1){ + if(Energy[ch]-Energy[ch+1]>threshold){ + peak_start.push_back(ch-Toffset); + while(Energy[ch]-Energy[ch+1]>0){ + ch++; + } + peak_stop.push_back(ch); + risetime.push_back(peak_stop[Npileup] - peak_start[Npileup]); + Npileup++; + } + ch++; + } + + // deduce amplitude + // -- define decay function + + fdecay->SetParameter(0,100.); + fdecay->SetParLimits(0,0,10000); + fdecay->FixParameter(1,decay_t); // all peaks should have same decay time -> fixed + fdecay->SetParameter(2,3426.); + fdecay->SetParLimits(2,3350,3500); + + + for(int pid=0;pid<Npileup;pid++){ + + // if(peak_start[pid]>140 && peak_start[pid]<180){ // exp + // if(risetime[pid]>3 && risetime[pid]<15){ + + // base line estimation + Int_t fit_debut; // begining channel of fit + Int_t fit_fin; // end channel of fit + // -- base line range + if(pid==0) fit_debut = max((int)peak_start[pid]-20,0); + else fit_debut = max((int)peak_start[pid]-20,(int)peak_stop[pid-1]); + fit_fin = peak_start[pid]; + // -- base line data + TGraph *gra_base = new TGraph(); + int tmpi = 0; + for(ch=fit_debut;ch<fit_fin;ch++){ + gra_base->SetPoint(tmpi,ch,Energy[ch]); + tmpi++; + } + if(fit_debut<fit_fin){ + // -- base line fit + fdecay->SetRange(fit_debut,fit_fin); + if(pid>0){ + gra_base->Fit("fdecay","rq"); + }else{ + gra_base->Fit("fdecay","rq"); + } + // deduce amplitude + // cout << Energy[peak_stop[pid]] << " "<< fdecay->Eval(peak_stop[pid]) << endl; + rawAmplitude.push_back(-Energy[peak_stop[pid]]+fdecay->Eval(peak_stop[pid])); + // calibration + calAmplitude.push_back(CalibRawAmplitude(rawAmplitude[pid])); + } + // } + //} + } + } + +} + +namespace LOCAL_CHIO +{ + double CalibRawAmplitude(const double rawAmplitude) + { + return CalibrationManager::getInstance()->ApplyCalibration("CHIO/CHIO_DIG_AMPLITUDE", rawAmplitude); + } +} diff --git a/NPLib/Chio/TChio_digPhysics.h b/NPLib/Chio/TChio_digPhysics.h new file mode 100644 index 000000000..4b075c69d --- /dev/null +++ b/NPLib/Chio/TChio_digPhysics.h @@ -0,0 +1,135 @@ +#ifndef __CHIODIGCAL__ +#define __CHIODIGCAL__ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Sandra Giron contact address: giron@ipno.in2p3.fr * + * * + * Creation Date : febuary 2011 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold chio treated data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + *****************************************************************************/ + +// STL +#include <vector> +#include <algorithm> + +// ROOT +#include "TObject.h" +#include "TVector3.h" +#include "TGraph.h" +#include "TF1.h" + +// NPLib +#include "TChio_digData.h" +#include "../include/VDetector.h" +#include "../include/CalibrationManager.h" + +using namespace std ; + +class TChio_digPhysics : public TObject, public NPA::VDetector +{ + + public: // Constructor and Destructor + TChio_digPhysics(); + ~TChio_digPhysics(); + + private: // Output data of interest + + ///// this is private in TChio_digCal.h but public in TPlastic_digPhysics.h...?? + + // ADC + vector<double> Energy; + /* Double_t Energy[350]; */ + //sum + // --- used in Ionization chamber + /* vector<double> Sum; */ + /* vector<double> Ampl; */ + /* vector<double> Sum_sscorr; */ + /* vector<double> Ampl_sscorr; */ + /* vector<short> Peak; */ + /* vector<double> Peak_dist; */ + /* vector<short> Peak_stop; */ + /* vector<double> Peak_base; */ + /* int PileupNbr; */ + // --- modified by megumi + int Npileup; // number of pileup + + vector<int> peak_start; // start of peak + vector<int> peak_stop; // top of peak + vector<int> risetime; + vector<double> rawAmplitude; + vector<double> calAmplitude; + + TF1 *fdecay; + + private: // Root Input and Output tree classes + + /* TChio_digData* EventData;//! */ + TChio_digData* EventData;//! + TChio_digPhysics* EventPhysics;//! + + public: // Inherited from VDetector Class + + // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token + void ReadConfiguration(string); + + // Add Parameter to the CalibrationManger + void AddParameterToCalibrationManager(); + + // Activated associated Branches and link it to the private member DetectorData address + // In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated + void InitializeRootInputRaw() ; + + // Activated associated Branches and link it to the private member DetectorPhysics address + // In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated + void InitializeRootInputPhysics() ; + + // Create associated branches and associated private member DetectorPhysics address + void InitializeRootOutput() ; + + // This method is called at each event read from the Input Tree. Aim is to build treat Raw dat in order to extract physical parameter. + void BuildPhysicalEvent(); + + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). + // This method aimed to be used for analysis performed during experiment, when speed is requiered. + // NB: This method can eventually be the same as BuildPhysicalEvent. + void BuildSimplePhysicalEvent(); + + // Those two method all to clear the Event Physics or Data + void ClearEventPhysics() {Clear();} + void ClearEventData() {EventData->Clear();} + + public : // Specific to ionisation chamber + + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + // Give and external TMustChio_digData object to TChio_anPhysics. Needed for online analysis. + void SetRawDataPointer(TChio_digData* rawDataPointer) {EventData = rawDataPointer;} + + // double GetChioEnergy() {return ...} + + ClassDef(TChio_digPhysics,1); // Physics structure + +}; + + +namespace LOCAL_CHIO +{ + double CalibRawAmplitude(double); +} + +#endif diff --git a/NPLib/Exogam/Makefile b/NPLib/Exogam/Makefile new file mode 100644 index 000000000..a1a5a3cb2 --- /dev/null +++ b/NPLib/Exogam/Makefile @@ -0,0 +1,42 @@ +include ../Makefile.arch + +#------------------------------------------------------------------------------ +SHARELIB = libExogamData.so libExogamPhysics.so + +all: $(SHARELIB) +#------------------------------------------------------------------------------ +############### Detector ############## + +## MUST2 ## +libExogamData.so: TExogamData.o TExogamDataDict.o + $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ + +TExogamDataDict.cxx: TExogamData.h + rootcint -f $@ -c $^ + +libExogamPhysics.so: TExogamPhysics.o TExogamPhysicsDict.o + $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ + +TExogamPhysicsDict.cxx: TExogamPhysics.h + rootcint -f $@ -c $^ + +# dependances +TExogamData.o: TExogamData.cxx TExogamData.h +TExogamPhysics.o: TExogamPhysics.cxx TExogamPhysics.h +####################################### + +############# Clean and More ########## +clean: + @rm -f core *~ *.o *Dict* + +distclean: + make clean; rm -f *.so + +.SUFFIXES: .$(SrcSuf) + +### + +.$(SrcSuf).$(ObjSuf): + $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< + + diff --git a/NPLib/Exogam/TExogamData.cxx b/NPLib/Exogam/TExogamData.cxx new file mode 100644 index 000000000..54d9db21f --- /dev/null +++ b/NPLib/Exogam/TExogamData.cxx @@ -0,0 +1,100 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : march 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold Exogam Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#include <iostream> +using namespace std; + +#include "TExogamData.h" + + +ClassImp(TExogamData) + +TExogamData::TExogamData() +{ + // Default constructor + Clear(); +} + + + +TExogamData::~TExogamData() +{ +} + + + +void TExogamData::Clear() +{ + // ECC / E + fEXO_ECC_E_Clover.clear(); + fEXO_ECC_E_Cristal.clear(); + fEXO_ECC_E_Energy.clear(); + // ECC / T + fEXO_ECC_T_Clover.clear(); + fEXO_ECC_T_Cristal.clear(); + fEXO_ECC_T_Time.clear(); + // GOCCE / E + fEXO_GOCCE_E_Clover.clear(); + fEXO_GOCCE_E_Cristal.clear(); + fEXO_GOCCE_E_Segment.clear(); + fEXO_GOCCE_E_Energy.clear(); + // GOCCE / T + fEXO_GOCCE_T_Clover.clear(); + fEXO_GOCCE_T_Cristal.clear(); + fEXO_GOCCE_T_Segment.clear(); + fEXO_GOCCE_T_Time.clear(); + + //GeFill + fEXO_Fill = -1; +} + + + +void TExogamData::Dump() const +{ + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; + + // ECC + // Energy + cout << "EXO_ECC_MultE = " << fEXO_ECC_E_Clover.size() << endl; + for (UShort_t i = 0; i < fEXO_ECC_E_Clover.size(); i++) { + cout << "CloverE: " << fEXO_ECC_E_Clover[i] << " CristalE: " << fEXO_ECC_E_Cristal[i] << " Energy: " << fEXO_ECC_E_Energy[i] << endl; + } + // Time + cout << "EXO_ECC_MultT = " << fEXO_ECC_T_Clover.size() << endl; + for (UShort_t i = 0; i < fEXO_ECC_T_Clover.size(); i++) { + cout << "CloverT: " << fEXO_ECC_T_Clover[i] << " CristalT: " << fEXO_ECC_T_Cristal[i] << " Time: " << fEXO_ECC_T_Time[i] << endl; + } + // GOCCE + // Energy + cout << "EXO_GOCCE_MultE = " << fEXO_GOCCE_E_Clover.size() << endl; + for (UShort_t i = 0; i < fEXO_GOCCE_E_Clover.size(); i++) { + cout << "CloverE: " << fEXO_GOCCE_E_Clover[i] << " CristalE: " << fEXO_GOCCE_E_Cristal[i] << " SegmentE: " << fEXO_GOCCE_E_Segment[i] << " Energy: " << fEXO_GOCCE_E_Energy[i] << endl; + } + // Time + cout << "EXO_GOCCE_MultT = " << fEXO_GOCCE_T_Clover.size() << endl; + for (UShort_t i = 0; i < fEXO_GOCCE_T_Clover.size(); i++) { + cout << "CloverT: " << fEXO_GOCCE_T_Clover[i] << " CristalT: " << fEXO_GOCCE_T_Cristal[i] << " SegmentT: " << fEXO_GOCCE_T_Segment[i] << " Time: " << fEXO_GOCCE_T_Time[i] << endl; + } + + //GeFill + cout << "EXO_GeFill =" << fEXO_Fill << endl; +} diff --git a/NPLib/Exogam/TExogamData.h b/NPLib/Exogam/TExogamData.h new file mode 100644 index 000000000..27977760f --- /dev/null +++ b/NPLib/Exogam/TExogamData.h @@ -0,0 +1,116 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : march 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold Exogam Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#ifndef __EXOGAMDATA__ +#define __EXOGAMDATA__ + +// STL +#include <vector> + +#include "TObject.h" + + + +class TExogamData : public TObject { + private: + // ECC / Energy + vector<UShort_t> fEXO_ECC_E_Clover; + vector<UShort_t> fEXO_ECC_E_Cristal; + vector<UShort_t> fEXO_ECC_E_Energy; + // ECC / Time + vector<UShort_t> fEXO_ECC_T_Clover; + vector<UShort_t> fEXO_ECC_T_Cristal; + vector<UShort_t> fEXO_ECC_T_Time; + // GOCCE / Energy + vector<UShort_t> fEXO_GOCCE_E_Clover; + vector<UShort_t> fEXO_GOCCE_E_Cristal; + vector<UShort_t> fEXO_GOCCE_E_Segment; + vector<UShort_t> fEXO_GOCCE_E_Energy; + // GOCCE / Time + vector<UShort_t> fEXO_GOCCE_T_Clover; + vector<UShort_t> fEXO_GOCCE_T_Cristal; + vector<UShort_t> fEXO_GOCCE_T_Segment; + vector<UShort_t> fEXO_GOCCE_T_Time; + // GeFill + UShort_t fEXO_Fill; + + public: + TExogamData(); + virtual ~TExogamData(); + + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + + ///////////////////// SETTERS //////////////////////// + // ECC / Energy + void SetECCEClover(UShort_t clov) { fEXO_ECC_E_Clover.push_back(clov);} + void SetECCECristal(UShort_t cris) { fEXO_ECC_E_Cristal.push_back(cris);} + void SetECCEEnergy(UShort_t ener) { fEXO_ECC_E_Energy.push_back(ener);} + // ECC / Time + void SetECCTClover(UShort_t clov) { fEXO_ECC_T_Clover.push_back(clov);} + void SetECCTCristal(UShort_t cris) { fEXO_ECC_T_Cristal.push_back(cris);} + void SetECCTTime(UShort_t time) { fEXO_ECC_T_Time.push_back(time);} + // GOCCE / Energy + void SetGOCCEEClover(UShort_t clov) { fEXO_GOCCE_E_Clover.push_back(clov);} + void SetGOCCEECristal(UShort_t cris) { fEXO_GOCCE_E_Cristal.push_back(cris);} + void SetGOCCEESegment(UShort_t seg) { fEXO_GOCCE_E_Segment.push_back(seg);} + void SetGOCCEEEnergy(UShort_t ener) { fEXO_GOCCE_E_Energy.push_back(ener);} + // GOCCE / Time + void SetGOCCETClover(UShort_t clov) { fEXO_GOCCE_T_Clover.push_back(clov);} + void SetGOCCETCristal(UShort_t cris) { fEXO_GOCCE_T_Cristal.push_back(cris);} + void SetGOCCETSegment(UShort_t seg) { fEXO_GOCCE_T_Segment.push_back(seg);} + void SetGOCCETTime(UShort_t time) { fEXO_GOCCE_T_Time.push_back(time);} + //GeFill + void SetGeFill(UShort_t Fill) {fEXO_Fill = Fill;} + + ///////////////////// GETTERS //////////////////////// + // ECC / Energy + // UShort_t GetCloverMult() {return fEXO_ECC_E_Clover.size();} + UShort_t GetECCEMult() {return fEXO_ECC_E_Clover.size();} + UShort_t GetECCEClover(Int_t i) {return fEXO_ECC_E_Clover.at(i);} + UShort_t GetECCECristal(Int_t i) {return fEXO_ECC_E_Cristal.at(i);} + UShort_t GetECCEEnergy(Int_t i) {return fEXO_ECC_E_Energy.at(i);} + // ECC / Time + UShort_t GetECCTMult() {return fEXO_ECC_T_Clover.size();} + UShort_t GetECCTClover(Int_t i) {return fEXO_ECC_T_Clover.at(i);} + UShort_t GetECCTCristal(Int_t i) {return fEXO_ECC_T_Cristal.at(i);} + UShort_t GetECCTTime(Int_t i) {return fEXO_ECC_T_Time.at(i);} + // GOCCE / Energy + UShort_t GetGOCCEEMult() {return fEXO_GOCCE_E_Clover.size();} // multiplicity of segments hit in one clover + UShort_t GetGOCCEEClover(Int_t i) {return fEXO_GOCCE_E_Clover.at(i);} + UShort_t GetGOCCEECristal(Int_t i) {return fEXO_GOCCE_E_Cristal.at(i);} + UShort_t GetGOCCEESegment(Int_t i) {return fEXO_GOCCE_E_Segment.at(i);} + UShort_t GetGOCCEEEnergy(Int_t i) {return fEXO_GOCCE_E_Energy.at(i);} + // GOCCE / Time + UShort_t GetGOCCETMult() {return fEXO_GOCCE_T_Clover.size();} + UShort_t GetGOCCETClover(Int_t i) {return fEXO_GOCCE_T_Clover.at(i);} + UShort_t GetGOCCETCristal(Int_t i) {return fEXO_GOCCE_T_Cristal.at(i);} + UShort_t GetGOCCETSegment(Int_t i) {return fEXO_GOCCE_T_Segment.at(i);} + UShort_t GetGOCCETTime(Int_t i) {return fEXO_GOCCE_T_Time.at(i);} + //GeFill + UShort_t GetGeFill() {return fEXO_Fill;} + + ClassDef(TExogamData,1) // ExogamData structure + }; + +#endif diff --git a/NPLib/Exogam/TExogamPhysics.cxx b/NPLib/Exogam/TExogamPhysics.cxx new file mode 100644 index 000000000..45237eda0 --- /dev/null +++ b/NPLib/Exogam/TExogamPhysics.cxx @@ -0,0 +1,676 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Sandra GIRON contact address: giron@ipno.in2p3.fr * + * * + * Creation Date : july 2010 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold exogam treated data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + *****************************************************************************/ +#include "TExogamPhysics.h" +using namespace EXOGAM_LOCAL; + +// STL +#include <sstream> +#include <iostream> +#include <cmath> +#include <stdlib.h> + +// NPL +#include "RootInput.h" +#include "RootOutput.h" + +// ROOT +#include "TChain.h" + + +/////////////////////////////////////////////////////////////////////////// +ClassImp(TExogamPhysics) +/////////////////////////////////////////////////////////////////////////// +TExogamPhysics::TExogamPhysics() +{ + // cout << "coconutsssssssssssssssssssssssssssss " << endl; + + EventMultiplicity = 0 ; + ECC_Multiplicity = 0 ; + GOCCE_Multiplicity = 0 ; + NumberOfHitClover = 0 ; + NumberOfHitCristal = 0 ; + + PreTreatedData = new TExogamData ; + EventData = new TExogamData ; + EventPhysics = this ; + NumberOfClover = 0 ; + CloverMult = 0 ; + +} + +/////////////////////////////////////////////////////////////////////////// +void TExogamPhysics::BuildSimplePhysicalEvent() +{ + + BuildPhysicalEvent(); +} +/////////////////////////////////////////////////////////////////////////// +void TExogamPhysics::PreTreat() +{ + ClearPreTreatedData(); + + //ECC + + //E + + for(unsigned int i = 0 ; i < EventData -> GetECCEMult(); i++) { + UShort_t cristal_E = 10000 ; UShort_t cristal_T = 2000; + //if(IsValidChannel) + { + int clover = EventData -> GetECCEClover(i); + int cristal = EventData -> GetECCECristal(i); + + if(EventData -> GetECCEEnergy(i) < 3000) cristal_E = CalibrationManager::getInstance()-> ApplyCalibration("EXOGAM/Cl"+itoa(clover)+"_Cr"+itoa(cristal)+"_Elow", EventData -> GetECCEEnergy(i)); + else cristal_E = CalibrationManager::getInstance()-> ApplyCalibration("EXOGAM/Cl"+itoa(clover)+"_Cr"+itoa(cristal)+"_Ehigh", EventData -> GetECCEEnergy(i)); + + + if(cristal_E > Threshold_ECC) + { + if(EventData -> GetECCTMult() !=0) + { + for(unsigned int k = 0; k < EventData -> GetECCTMult(); k++) + { + if(clover == EventData -> GetECCTClover(k) && cristal == EventData -> GetECCTCristal(k)) + { + // cout << EventData -> GetECCTTime(k) << endl; + + if(EventData -> GetECCTTime(k) < 16383) cristal_T = CalibrationManager::getInstance()-> ApplyCalibration("EXOGAM/Cl"+itoa(clover)+"_Cr"+itoa(cristal)+"_T", EventData -> GetECCTTime(k)); + else cristal_T = 2500; + + //if(cristal_T >5000 && cristal_T !=25000 ) cout << "PreTreat " << cristal_T << " " << EventData -> GetECCTTime(k) << " " << clover << " " << cristal << " " << EventData->GetECCTMult() << endl; + + PreTreatedData->SetECCEClover ( EventData->GetECCEClover(i) ) ; + PreTreatedData->SetECCECristal( EventData->GetECCECristal(i) ) ; + PreTreatedData->SetECCEEnergy ( cristal_E ) ; + PreTreatedData->SetECCTClover ( EventData->GetECCEClover(i) ) ; + PreTreatedData->SetECCTCristal( EventData->GetECCECristal(i) ) ; + PreTreatedData->SetECCTTime ( cristal_T ) ; + + ECC_Multiplicity ++; + GOCCE_Multiplicity++; + } + else { } + } + } + + else // case of calibration with ECCTMult = 0 + { + cristal_T = 3000; + //cout << cristal_E << endl; + + PreTreatedData->SetECCEClover ( EventData->GetECCEClover(i) ) ; + PreTreatedData->SetECCECristal( EventData->GetECCECristal(i) ) ; + PreTreatedData->SetECCEEnergy ( cristal_E ) ; + PreTreatedData->SetECCTClover ( EventData->GetECCEClover(i) ) ; + PreTreatedData->SetECCTCristal( EventData->GetECCECristal(i) ) ; + PreTreatedData->SetECCTTime ( cristal_T ) ; + // if(cristal_T > 5000 && cristal_T !=30000) cout << "PreTreat (default = 30000) " << cristal_T << " " << clover << " " << cristal << endl; + + + } + } + } + } + + //cout << PreTreatedData-> GetECCTMult() << " " << PreTreatedData-> GetECCEMult() << endl; + + + //GOCCE + + //E + + for(unsigned int i = 0 ; i < EventData -> GetGOCCEEMult(); i++) { + UShort_t segment_E = 25000; + + //if(IsValidChannel) + { + int clover = EventData -> GetGOCCEEClover(i); + int cristal = EventData -> GetGOCCEECristal(i); + int segment = EventData -> GetGOCCEESegment(i); + + if(EventData -> GetGOCCEEEnergy(i) > RawThreshold_GOCCE) + { + segment_E = CalibrationManager::getInstance()->ApplyCalibration("EXOGAM/Cl"+itoa(clover)+"_Cr"+itoa(cristal)+"_Seg"+itoa(segment)+"_E", EventData -> GetGOCCEEEnergy(i)); + + if(segment_E > Threshold_GOCCE) + { + PreTreatedData->SetGOCCEEClover ( clover ) ; + PreTreatedData->SetGOCCEECristal( cristal ) ; + PreTreatedData->SetGOCCEESegment( segment ) ; + PreTreatedData->SetGOCCEEEnergy ( segment_E ) ; + + } + } + else + { + + } + } + } + + //cout << "EXOGAM pretreat ok!" << endl; + return; + +} +/////////////////////////////////////////////////////////////////////////// + +void TExogamPhysics::BuildPhysicalEvent() +{ + //cout << "Exogam Build ?" << endl; + + PreTreat(); + + if(PreTreatedData -> GetECCEMult() != PreTreatedData -> GetECCTMult()) cout << PreTreatedData -> GetECCEMult() << " " << PreTreatedData -> GetECCTMult() << endl; + + + for(unsigned int i = 0 ; i < PreTreatedData -> GetECCEMult(); i++) { + + // cout << i << " " << cristal_E << endl; + // if(PreTreatedData->GetECCTTime(i) > 0) + { + ECC_E.push_back(PreTreatedData->GetECCEEnergy(i)); + ECC_T.push_back(PreTreatedData->GetECCTTime(i)); + ECC_CloverNumber.push_back(PreTreatedData->GetECCEClover(i)); + ECC_CristalNumber.push_back(PreTreatedData->GetECCECristal(i)); + + // cout << "BuildPhys " << PreTreatedData->GetECCEClover(i) << " " << PreTreatedData->GetECCECristal(i)<< " " << PreTreatedData->GetECCTTime(i) << " " << endl; + } + } + + + for(unsigned int j = 0 ; j < PreTreatedData -> GetGOCCEEMult(); j++) { + GOCCE_E.push_back(PreTreatedData->GetGOCCEEEnergy(j)); + GOCCE_CloverNumber.push_back(PreTreatedData->GetGOCCEEClover(j)); + GOCCE_CristalNumber.push_back(PreTreatedData->GetGOCCEECristal(j)); + GOCCE_SegmentNumber.push_back(PreTreatedData->GetGOCCEESegment(j)); + } + + + //int NumberOfHitClover = 0; + + int DetectorID = -1; + + for( unsigned short i = 0 ; i < PreTreatedData->GetECCEMult() ; i++ ) + { + // cout << PreTreatedData->GetECCEClover(i) << endl; + if( PreTreatedData->GetECCEClover(i) != DetectorID) + { + if(i==0) + { + NumberOfHitClover++; + } + else if(PreTreatedData->GetECCEClover(i)!= PreTreatedData->GetECCEClover(i-1) ) + { + NumberOfHitClover++; + } + } + if(NumberOfHitClover == 4) break; + //clover_mult -> Fill(NumberOfHitClover); + + } + + //cout << "NumberOfHitClover " << NumberOfHitClover << endl; + + map<int, vector<int> > MapCristal; + map<int, vector<int> > MapSegment; + + map<int, vector<int> > :: iterator it; // iterator used with MapCristal + map<int, vector<int> > :: iterator at; // iterator used with MapSegment + + vector<int> PositionOfCristal_Buffer_ECC; + vector<int> PositionOfSegment_Buffer_GOCCE; + + + //Fill map Cristal + for(int clo = 0; clo < NumberOfClover; clo++) + { + for(unsigned int k = 0; k < ECC_CloverNumber.size(); k++) + { + if(ECC_CloverNumber.at(k) == clo) // && ECC_CristalNumber.at(k)== cri ) + PositionOfCristal_Buffer_ECC.push_back(k); + } + if(PositionOfCristal_Buffer_ECC.size() != 0) MapCristal[clo] = PositionOfCristal_Buffer_ECC; + + PositionOfCristal_Buffer_ECC.clear(); + + } + + + //Fill map Segment + for(int clo = 0; clo < NumberOfClover; clo++) + { + for(int cri = 0; cri < 4 ; cri++) + { + // for(int seg = 0; seg < 4 ; seg++) + { + for(unsigned int m = 0; m < GOCCE_CloverNumber.size(); m++) + { + if(GOCCE_CloverNumber.at(m) == clo && GOCCE_CristalNumber.at(m) == cri)// && GOCCE_SegmentNumber.at(m) == seg) + { + // PositionOfSegment_Buffer_GOCCE.push_back(4*clo+cri); + PositionOfSegment_Buffer_GOCCE.push_back(m); + } + } + } + if(PositionOfSegment_Buffer_GOCCE.size() != 0) MapSegment[4*clo+cri] = PositionOfSegment_Buffer_GOCCE; + + PositionOfSegment_Buffer_GOCCE.clear(); + } + } + + // Treatment + for(int clo = 0; clo < NumberOfClover ; clo++) + { + double E = 0; double T = 0; + int mult_cristal = 0; + int cristal = -1 , segment; + + int cristal_Emax = 0; int cristal_Emin = 0; + int Emax = 0, Emin = 1000000; + int Tmin = 0, Tmax = 0; + + //ADD-BACK + it = MapCristal.find(clo); + + int cristal_cond = 0; + + if(it != MapCristal.end()) + { + vector<int> PositionOfCristal = it -> second; + + mult_cristal = PositionOfCristal.size(); + //if(mult_cristal!=0) cristal_mult -> Fill(mult_cristal); + + // ADD-BACK + //cout << "boucle" << endl; + + for(unsigned int k = 0; k < PositionOfCristal.size(); k++) + { + int indice = PositionOfCristal.at(k); + + cristal_cond += ECC_CristalNumber.at(indice); + // cout << ECC_CristalNumber.at(k) << " " ECC_E.at(k) << endl; + + if(mult_cristal < 3) + { + E+= ECC_E.at(indice); + + if(ECC_E.at(indice) < Emin) { + cristal_Emin = ECC_CristalNumber.at(indice); + Emin = ECC_E.at(indice); + Tmin = ECC_T.at(indice); + } + + if(ECC_E.at(indice) > Emax) { + cristal_Emax = ECC_CristalNumber.at(indice); + Emax = ECC_E.at(indice); + Tmax = ECC_T.at(indice); + } + } + + else // case of multiplicity = 3 or 4 + { + E = -1; cristal_Emax = -1; cristal_Emin = -1; Tmax = -1; Tmin = -1; + } + + // cout << ECC_E.at(indice) << " " << Emax << " " << cristal_Emax << " " << Emin << " " << cristal_Emin << endl; + + } + + if( (mult_cristal==1) || (mult_cristal ==2 && cristal_cond %2 == 1) ) + { + // cout << cristal_cond << endl; + + //cristal = cristal_Emax; T = Tmax; + //cout << Emax << " " << cristal_Emax << " " << Emin << " " << cristal_Emin << endl; + + if(E > 500) { cristal = cristal_Emax; T = Tmax; } + else { cristal = cristal_Emin; T = Tmin; } + + + // DOPPLER CORRECTION + + at = MapSegment.find(4*clo+cristal); + segment = -1; + + if(at != MapSegment.end()) + { + vector<int> PositionOfSegment = at -> second; // position of segment k in the vector + + int segment_max = -1, E_temp = -1; + + for(unsigned int m = 0; m < PositionOfSegment.size(); m++) // loop on hit segments of cristal cri of clover clo + { + int indice = PositionOfSegment.at(m); + + if(GOCCE_E.at(indice) > 0 && GOCCE_CristalNumber.at(indice) == cristal) + { + if( GOCCE_E.at(indice) > E_temp ) + { + segment_max = GOCCE_SegmentNumber.at(indice) ; + E_temp = GOCCE_E.at(indice); + } + } + } + segment = segment_max; + } + + } + + + if(E > 0 && cristal != -1 && segment != -1) + { + TotalEnergy_lab.push_back(E); + Time.push_back(T); + CloverNumber.push_back(clo); + CristalNumber.push_back(cristal); + SegmentNumber.push_back(segment); + + double theta = GetSegmentAngleTheta(clo, cristal, segment); + + Theta.push_back(theta); + + double doppler_E = DopplerCorrection(E, theta); + DopplerCorrectedEnergy.push_back(doppler_E); + + // cout << E << " " << clo << " " << cristal << " " << segment << " " << theta << " " << doppler_E << endl; + + } + + } // end of condition over CristalMap + + } // loop over NumberOfClover + + CloverMult = GetClover_Mult(); + + //cout << "Exogam fine" << endl; +} + + +double TExogamPhysics::DopplerCorrection(double E, double Theta) +{ + double Pi = 3.141592654 ; + + double E_corr = 0; + //double beta = 0.197; // baptiste value + double beta = 0.23; + double gamma = 1./ sqrt(1-beta*beta); + + E_corr = gamma * E * ( 1. - beta * cos(Theta*Pi/180.)); + + return(E_corr); + +} + + +/////////////////////////////////////////////////////////////////////////// + + +void TExogamPhysics::Clear() +{ + EventMultiplicity = 0; + ECC_Multiplicity = 0; + GOCCE_Multiplicity = 0; + NumberOfHitClover = 0; + NumberOfHitCristal = 0; + + ECC_CloverNumber .clear() ; + ECC_CristalNumber .clear() ; + GOCCE_CloverNumber .clear() ; + GOCCE_CristalNumber .clear() ; + GOCCE_SegmentNumber .clear() ; + + // ECC + ECC_E.clear() ; + ECC_T.clear(); + + // GOCCE + GOCCE_E.clear() ; + + CristalNumber.clear() ; + SegmentNumber.clear() ; + CloverNumber .clear() ; + + TotalEnergy_lab .clear() ; + Time .clear() ; + DopplerCorrectedEnergy.clear() ; + Position .clear() ; + Theta .clear() ; + + + +} +/////////////////////////////////////////////////////////////////////////// + +//// Innherited from VDetector Class //// + +// Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token +void TExogamPhysics::ReadConfiguration(string Path) +{ + + ifstream ConfigFile; + ConfigFile.open(Path.c_str()); + string LineBuffer ; + string DataBuffer ; + string AngleFile ; + + + bool check_C = false ; + + bool ReadingStatus = false ; + + + + while (!ConfigFile.eof()) + { + getline(ConfigFile, LineBuffer); + + //If line is a Start Up CATS bloc, Reading toggle to true + if (LineBuffer.compare(0, 12, "EXOGAMClover") == 0) + { + cout << "///" << endl ; + cout << "EXOGAM Detector found: " << endl ; + ReadingStatus = true ; + } + + // Else don't toggle to Reading Block Status + else ReadingStatus = false ; + + // Reading Block + while(ReadingStatus) + { + ConfigFile >> DataBuffer ; + // Comment Line + if(DataBuffer.compare(0, 1, "%") == 0) { + ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' ); + } + + // Finding another telescope (safety), toggle out + else if (DataBuffer.compare(0, 12, "EXOGAMClover") == 0) { + cout << "WARNING: Another EXOGAM is found before standard sequence of Token, Error may occured in EXOGAM definition" << endl ; + ReadingStatus = false ; + } + + + // File angle method + + if (DataBuffer.compare(0, 12, "ANGLES_FILE=") == 0) { + check_C = true; + ConfigFile >> DataBuffer ; + AngleFile = DataBuffer; + + cout << "File angle used : " << DataBuffer << endl; + } + + + // End File angle Method + + ///////////////////////////////////////////////// + // If All necessary information there, toggle out + if (check_C) + { + ReadingStatus = false; + + ///Add The previously define telescope + + AddClover(AngleFile); + + check_C = false; + + } + } + + } + +} + + +void TExogamPhysics::AddClover(string AngleFile) +{ + ifstream file; + // TString filename = Form("posBaptiste/angles_exogam_clover%d.txt",NumberOfClover); + // TString filename = Form("posz42_simu50mm/angles_exogam_clover%d.txt",NumberOfClover); + // TString filename = Form("posz42_exp_stat_demiring/angles_exogam_clover%d.txt",NumberOfClover); + + string path = "posz42_exp_stat_demiring/"; + TString filename = path + AngleFile; + + cout << filename << endl; + file.open(filename); + if(!file) cout << filename << " was not opened" << endl; + + vector <double> Angles; + vector < vector <double> > Segment_angles; + vector < vector < vector <double> > > Cristal_angles; + + Cristal_angles.clear(); + + double angle; string buffer; + + for(int i = 0; i < 4; i++) + { + Segment_angles.clear(); + + for(int j = 0; j < 4; j++) + { + Angles.clear(); + + for(int k = 0; k < 2; k++) + { + file >> buffer >> angle; + + Angles.push_back(angle); // Theta (k = 0) Phi (k = 1) + + //cout << angle << endl; + // cout << NumberOfClover << " " << Angles[0] << endl; + + } + + Segment_angles.push_back(Angles); + } + + Cristal_angles.push_back(Segment_angles); + } + + Clover_Angles_Theta_Phi.push_back(Cristal_angles); + + file.close(); + + NumberOfClover++; + +} + + +// Add Parameter to the CalibrationManger +void TExogamPhysics::AddParameterToCalibrationManager() +{ + + CalibrationManager* Cal = CalibrationManager::getInstance(); + + for(int i = 0 ; i < NumberOfClover ; i++) + { + for( int j = 0 ; j < 4 ; j++) + { + Cal->AddParameter("EXOGAM", "Cl"+itoa(i)+"_Cr"+itoa(j)+"_Elow" ,"EXOGAM_Cl"+itoa(i)+"_Cr"+itoa(j)+"_Elow"); + Cal->AddParameter("EXOGAM", "Cl"+itoa(i)+"_Cr"+itoa(j)+"_Ehigh","EXOGAM_Cl"+itoa(i)+"_Cr"+itoa(j)+"_Ehigh"); + Cal->AddParameter("EXOGAM", "Cl"+itoa(i)+"_Cr"+itoa(j)+"_T","EXOGAM_Cl"+itoa(i)+"_Cr"+itoa(j)+"_T") ; + + for( int k = 0 ; k < 4 ; k++) + { + Cal->AddParameter("EXOGAM", "Cl"+itoa(i)+"_Cr"+itoa(j)+"_Seg"+itoa(k)+"_E","EXOGAM_Cl"+itoa(i)+"_Cr"+itoa(j)+"_Seg"+itoa(k)+"_E") ; + } + } + } +} + + +// Activated associated Branches and link it to the private member DetectorData address +// In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated +void TExogamPhysics::InitializeRootInput() +{ + TChain* inputChain = RootInput::getInstance()->GetChain() ; + inputChain->SetBranchStatus( "EXOGAM" , true ) ; + inputChain->SetBranchStatus( "fEXO_*" , true ) ; + inputChain->SetBranchAddress( "EXOGAM" , &EventData ) ; + + /* + TList* outputList = RootOutput::getInstance()->GetList(); + clover_mult = new TH1F("clover_mult","clover_mult",20,0,20); + outputList->Add(clover_mult); + + cristal_mult = new TH1F("cristal_mult","cristal_mult",20,0,20); + outputList->Add(cristal_mult); + */ +} + + +// Create associated branches and associated private member DetectorPhysics address +void TExogamPhysics::InitializeRootOutput() +{ + TTree* outputTree = RootOutput::getInstance()->GetTree() ; + outputTree->Branch( "EXOGAM" , "TExogamPhysics" , &EventPhysics ) ; + + // control histograms if needed + /* + TList* outputList = RootOutput::getInstance()->GetList(); + controle = new TH1F("controle","histo de controle",20,0,20); + outputList->Add(controle); + */ + +} + + +/////////////////////////////////////////////////////////////////////////// +namespace EXOGAM_LOCAL +{ + // tranform an integer to a string + string itoa(int value) + { + std::ostringstream o; + + if (!(o << value)) + return "" ; + + return o.str(); + } +} + + ///////////////////////////// diff --git a/NPLib/Exogam/TExogamPhysics.h b/NPLib/Exogam/TExogamPhysics.h new file mode 100644 index 000000000..bbe045694 --- /dev/null +++ b/NPLib/Exogam/TExogamPhysics.h @@ -0,0 +1,170 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: S. Giron contact address: giron@ipno.in2p3.fr * + * * + * Creation Date : febuary 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold exogam treated data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + *****************************************************************************/ +#ifndef TEXOGAMPHYSICS_H +#define TEXOGAMPHYSICS_H + +// STL +#include <vector> +#include <map> + +// NPL +#include "../include/CalibrationManager.h" +#include "../include/VDetector.h" +#include "TExogamData.h" + +// ROOT +#include "TVector2.h" +#include "TVector3.h" +#include "TObject.h" +#include "TH1.h" + +using namespace std ; + +class TExogamPhysics : public TObject, public NPA::VDetector +{ + public: + TExogamPhysics() ; + ~TExogamPhysics() {}; + + + public: + void Clear() ; + void Clear(const Option_t*) {}; + + // Provide Physical Multiplicity + Int_t EventMultiplicity ; + Int_t ECC_Multiplicity ; + Int_t GOCCE_Multiplicity ; + Int_t NumberOfClover ; //! + + // Clover + Int_t NumberOfHitClover ; //! + Int_t NumberOfHitCristal ; //! + vector<int> ECC_CloverNumber ; + vector<int> ECC_CristalNumber ; + vector<int> GOCCE_CloverNumber ; + vector<int> GOCCE_CristalNumber ; + vector<int> GOCCE_SegmentNumber ; + + // ECC + vector<double> ECC_E ; + vector<double> ECC_T ; + + // GOCCE + vector<double> GOCCE_E ; + + // Add-Back and Doppler correction + + vector<int> CristalNumber ; + vector<int> SegmentNumber ; + vector<int> CloverNumber ; + int CloverMult ; + + vector<double> TotalEnergy_lab ; + vector<double> Time ; + vector<double> DopplerCorrectedEnergy ; + vector<double> Position ; + vector<double> Theta ; + + vector < vector < vector < vector <double> > > > Clover_Angles_Theta_Phi; //! + + /* + TH1F* clover_mult ; + TH1F* cristal_mult ; + */ + + public: // Innherited from VDetector Class + + // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token + void ReadConfiguration(string) ; + + + // Add Parameter to the CalibrationManger + void AddParameterToCalibrationManager() ; + + + // Activated associated Branches and link it to the private member DetectorData address + // In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated + void InitializeRootInput() ; + + + // Create associated branches and associated private member DetectorPhysics address + void InitializeRootOutput() ; + + // This method is called at each event read from the Input Tree. Aim is to build a tree of calibrated data. + void PreTreat() ; + + // This method is called at each event read from the Input Tree. + void BuildPhysicalEvent() ; + + + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). + // This method aimed to be used for analysis performed during experiment, when speed is requiered. + // NB: This method can eventually be the same as BuildPhysicalEvent. + void BuildSimplePhysicalEvent() ; + + double DopplerCorrection(double Energy, double Theta); + + // Those two method all to clear the Event Physics or Data + void ClearEventPhysics() {Clear();} + void ClearEventData() {EventData->Clear();} + void ClearPreTreatedData() {PreTreatedData->Clear();} + + private: // Root Input and Output tree classes + + + TExogamData* EventData ;//! + TExogamData* PreTreatedData ;//! + TExogamPhysics* EventPhysics ;//! + + + public: // Specific to EXOGAM Array + // Add a Clover + void AddClover(string AngleFile); + + Int_t GetClover_Mult() { return(CloverNumber.size()); } + // Int_t GetECC_Mult() { return(ECC_CristalNumber.size()); } + // Int_t GetGOCCE_Mult() { return(GOCCE_SegmentNumber.size()); } + + Double_t GetSegmentAnglePhi(int Clover, int Cristal, int Segment) {return(Clover_Angles_Theta_Phi[Clover][Cristal][Segment][1]);}; + Double_t GetSegmentAngleTheta(int Clover, int Cristal, int Segment) {return(Clover_Angles_Theta_Phi[Clover][Cristal][Segment][0]);}; + + + + ClassDef(TExogamPhysics,1) // ExogamPhysics structure + }; + +namespace EXOGAM_LOCAL +{ + const double Threshold_ECC = 50; + const double Threshold_GOCCE = 0; + const double RawThreshold_ECC = 0; + const double RawThreshold_GOCCE = 0; + + + // tranform an integer to a string + string itoa(int value); + + +} + + +#endif diff --git a/NPLib/Makefile b/NPLib/Makefile index 37a81adf6..7412348ca 100644 --- a/NPLib/Makefile +++ b/NPLib/Makefile @@ -33,7 +33,7 @@ clean: distclean: rm -f ./lib/* - rm -f ./include/*.h + rm -f ./include/* rm -f liblist rm -f ./scripts/NPToolLogon_C* ./scripts/makefile.sh distclean diff --git a/NPLib/Plastic/TPlasticPhysics.h b/NPLib/Plastic/TPlasticPhysics.h index 07f61f6e3..4c56cadae 100644 --- a/NPLib/Plastic/TPlasticPhysics.h +++ b/NPLib/Plastic/TPlasticPhysics.h @@ -40,8 +40,11 @@ class TPlasticPhysics : public TObject, public NPA::VDetector TPlasticPhysics(); ~TPlasticPhysics(); + public: + void Clear(); + void Clear(const Option_t*) {}; + public: // Calibrated Data - vector<UShort_t> DetectorNumber ; vector<Double_t> Energy; vector<Double_t> Time; @@ -62,20 +65,20 @@ class TPlasticPhysics : public TObject, public NPA::VDetector // In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated void InitializeRootInputPhysics() ; - // Create associated branches and associated private member DetectorPhysics address void InitializeRootOutput(); - // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. void BuildPhysicalEvent(); - // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). // This method aimed to be used for analysis performed during experiment, when speed is requiered. // NB: This method can eventually be the same as BuildPhysicalEvent. void BuildSimplePhysicalEvent(); + // Give and external TPlasticData object to TPlasticPhysics. Needed for online analysis for example. + void SetRawDataPointer(TPlasticData* rawDataPointer) {EventData = rawDataPointer;} + // Those two method all to clear the Event Physics or Data void ClearEventPhysics() {Clear();} void ClearEventData() {EventData->Clear();} @@ -85,9 +88,6 @@ class TPlasticPhysics : public TObject, public NPA::VDetector TPlasticData* EventData ;//! TPlasticPhysics* EventPhysics ;//! - void Clear(); - void Clear(const Option_t*) {}; - ClassDef(TPlasticPhysics,1) // PlasticPhysics structure }; diff --git a/NPLib/Vamos/Makefile b/NPLib/Vamos/Makefile new file mode 100644 index 000000000..c59d909e9 --- /dev/null +++ b/NPLib/Vamos/Makefile @@ -0,0 +1,58 @@ +include ../Makefile.arch + +#------------------------------------------------------------------------------ +SHARELIB = libVamosPlasticData.so libVamosFingerData.so \ + libVamosCHIOData.so libVamosDCData.so + +all: $(SHARELIB) +#------------------------------------------------------------------------------ +############### Detector ############## + +## MUST2 ## +libVamosPlasticData.so: TVamosPlasticData.o TVamosPlasticDataDict.o + $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ + +TVamosPlasticDataDict.cxx: TVamosPlasticData.h + rootcint -f $@ -c $^ + +libVamosFingerData.so: TVamosFingerData.o TVamosFingerDataDict.o + $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ + +TVamosFingerDataDict.cxx: TVamosFingerData.h + rootcint -f $@ -c $^ + +libVamosCHIOData.so: TVamosCHIOData.o TVamosCHIODataDict.o + $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ + +TVamosCHIODataDict.cxx: TVamosCHIOData.h + rootcint -f $@ -c $^ + +libVamosDCData.so: TVamosDCData.o TVamosDCDataDict.o + $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ + +TVamosDCDataDict.cxx: TVamosDCData.h + rootcint -f $@ -c $^ + + +# dependances +TVamosPlasticData.o: TVamosPlasticData.cxx TVamosPlasticData.h +TVamosFingerData.o: TVamosFingerData.cxx TVamosFingerData.h +TVamosCHIOData.o: TVamosCHIOData.cxx TVamosCHIOData.h +TVamosDCData.o: TVamosDCData.cxx TVamosDCData.h +####################################### + +############# Clean and More ########## +clean: + @rm -f core *~ *.o *Dict* + +distclean: + make clean; rm -f *.so + +.SUFFIXES: .$(SrcSuf) + +### + +.$(SrcSuf).$(ObjSuf): + $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< + + diff --git a/NPLib/Vamos/TVamosCHIOData.cxx b/NPLib/Vamos/TVamosCHIOData.cxx new file mode 100644 index 000000000..2c03d0baf --- /dev/null +++ b/NPLib/Vamos/TVamosCHIOData.cxx @@ -0,0 +1,75 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : July 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class holds VAMOS Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#include <iostream> +using namespace std; + +#include "TVamosCHIOData.h" + + +ClassImp(TVamosCHIOData) + +TVamosCHIOData::TVamosCHIOData() +{ + // Default constructor + Clear(); +} + + + +TVamosCHIOData::~TVamosCHIOData() +{ +} + + + +void TVamosCHIOData::Clear() +{ + // A + fVamos_CHIO_A_PadNbr.clear(); + fVamos_CHIO_A_Energy.clear(); + // B + fVamos_CHIO_B_PadNbr.clear(); + fVamos_CHIO_B_Energy.clear(); + // C + fVamos_CHIO_C_PadNbr.clear(); + fVamos_CHIO_C_Energy.clear(); +} + + + +void TVamosCHIOData::Dump() const +{ + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; + + // A + cout << "Vamos_CHIO_MultA = " << fVamos_CHIO_A_PadNbr.size() << endl; + for (UShort_t i = 0; i < fVamos_CHIO_A_PadNbr.size(); i++) + cout << "PadNbrA: " << fVamos_CHIO_A_PadNbr[i] << " EnergyA: " << fVamos_CHIO_A_Energy[i] << endl; + // B + cout << "Vamos_CHIO_MultB = " << fVamos_CHIO_B_PadNbr.size() << endl; + for (UShort_t i = 0; i < fVamos_CHIO_B_PadNbr.size(); i++) + cout << "PadNbrB: " << fVamos_CHIO_B_PadNbr[i] << " EnergyB: " << fVamos_CHIO_B_Energy[i] << endl; + // C + cout << "Vamos_CHIO_MultC = " << fVamos_CHIO_C_PadNbr.size() << endl; + for (UShort_t i = 0; i < fVamos_CHIO_C_PadNbr.size(); i++) + cout << "PadNbrC: " << fVamos_CHIO_C_PadNbr[i] << " EnergyC: " << fVamos_CHIO_C_Energy[i] << endl; +} diff --git a/NPLib/Vamos/TVamosCHIOData.h b/NPLib/Vamos/TVamosCHIOData.h new file mode 100644 index 000000000..53e0f1bde --- /dev/null +++ b/NPLib/Vamos/TVamosCHIOData.h @@ -0,0 +1,82 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : July 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class holds VAMOS Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#ifndef __VAMOSCHIODATA__ +#define __VAMOSCHIODATA__ + +#include <vector> + +#include "TObject.h" + + + +class TVamosCHIOData : public TObject { + private: + // Row A + vector<UShort_t> fVamos_CHIO_A_PadNbr; + vector<UShort_t> fVamos_CHIO_A_Energy; + + // Row B + vector<UShort_t> fVamos_CHIO_B_PadNbr; + vector<UShort_t> fVamos_CHIO_B_Energy; + + // Row C + vector<UShort_t> fVamos_CHIO_C_PadNbr; + vector<UShort_t> fVamos_CHIO_C_Energy; + + + public: + TVamosCHIOData(); + virtual ~TVamosCHIOData(); + + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + ///////////////////// SETTERS //////////////////////// + // A + void SetVamosCHIOPadNbrA(UShort_t PadNbrA) {fVamos_CHIO_A_PadNbr.push_back(PadNbrA);} + void SetVamosCHIOEnergyA(UShort_t EnergyA) {fVamos_CHIO_A_Energy.push_back(EnergyA);} + // B + void SetVamosCHIOPadNbrB(UShort_t PadNbrB) {fVamos_CHIO_B_PadNbr.push_back(PadNbrB);} + void SetVamosCHIOEnergyB(UShort_t EnergyB) {fVamos_CHIO_B_Energy.push_back(EnergyB);} + // C + void SetVamosCHIOPadNbrC(UShort_t PadNbrC) {fVamos_CHIO_C_PadNbr.push_back(PadNbrC);} + void SetVamosCHIOEnergyC(UShort_t EnergyC) {fVamos_CHIO_C_Energy.push_back(EnergyC);} + + ///////////////////// GETTERS //////////////////////// + // A + UShort_t GetVamosCHIOMultA() {return fVamos_CHIO_A_PadNbr.size();} + UShort_t GetVamosCHIOPadNbrA(Int_t i) {return fVamos_CHIO_A_PadNbr.at(i);} + UShort_t GetVamosCHIOEnergyA(Int_t i) {return fVamos_CHIO_A_Energy.at(i);} + // B + UShort_t GetVamosCHIOMultB() {return fVamos_CHIO_B_PadNbr.size();} + UShort_t GetVamosCHIOPadNbrB(Int_t i) {return fVamos_CHIO_B_PadNbr.at(i);} + UShort_t GetVamosCHIOEnergyB(Int_t i) {return fVamos_CHIO_B_Energy.at(i);} + // C + UShort_t GetVamosCHIOMultC() {return fVamos_CHIO_C_PadNbr.size();} + UShort_t GetVamosCHIOPadNbrC(Int_t i) {return fVamos_CHIO_C_PadNbr.at(i);} + UShort_t GetVamosCHIOEnergyC(Int_t i) {return fVamos_CHIO_C_Energy.at(i);} + + ClassDef(TVamosCHIOData,1) // VamosCHIOData structure +}; + +#endif diff --git a/NPLib/Vamos/TVamosDCData.cxx b/NPLib/Vamos/TVamosDCData.cxx new file mode 100644 index 000000000..8cf37f870 --- /dev/null +++ b/NPLib/Vamos/TVamosDCData.cxx @@ -0,0 +1,94 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : July 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class holds VAMOS Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#include <iostream> +using namespace std; + +#include "TVamosDCData.h" + + +ClassImp(TVamosDCData) + +TVamosDCData::TVamosDCData() +{ + // Default constructor + Clear(); +} + + + +TVamosDCData::~TVamosDCData() +{ +} + + + +void TVamosDCData::Clear() +{ + // Strips from row 1 + fVamos_DC_Strip1_DetNbr.clear(); + fVamos_DC_Strip1_StripNbr.clear(); + fVamos_DC_Strip1_Energy.clear(); + // Strips from row 2 + fVamos_DC_Strip2_DetNbr.clear(); + fVamos_DC_Strip2_StripNbr.clear(); + fVamos_DC_Strip2_Energy.clear(); + // Efil + fVamos_DC_Efil_DetNbr.clear(); + fVamos_DC_Efil_Energy.clear(); + // Efil PileUp + fVamos_DC_Efil_PileUp_DetNbr.clear(); + fVamos_DC_Efil_PileUp_Energy.clear(); + // Tfil + fVamos_DC_Tfil_DetNbr.clear(); + fVamos_DC_Tfil_Time.clear(); +} + + + +void TVamosDCData::Dump() const +{ + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; + + // Strips from row 1 + cout << "Vamos_DC_Strip1_Mult = " << fVamos_DC_Strip1_DetNbr.size() << endl; + for (UShort_t i = 0; i < fVamos_DC_Strip1_DetNbr.size(); i++) + cout << "Det_Strip1: " << fVamos_DC_Strip1_DetNbr[i] << " Strip_Strip1: " << fVamos_DC_Strip1_StripNbr[i] << " Energy_Strip1: " << fVamos_DC_Strip1_Energy[i] << endl; + // Strips from row 2 + cout << "Vamos_DC_Strip2_Mult = " << fVamos_DC_Strip2_DetNbr.size() << endl; + for (UShort_t i = 0; i < fVamos_DC_Strip2_DetNbr.size(); i++) + cout << "Det_Strip2: " << fVamos_DC_Strip2_DetNbr[i] << " Strip_Strip2: " << fVamos_DC_Strip2_StripNbr[i] << " Energy_Strip2: " << fVamos_DC_Strip1_Energy[i] << endl; + + // Efil + cout << "Vamos_DC_Efil_Mult = " << fVamos_DC_Efil_DetNbr.size() << endl; + for (UShort_t i = 0; i < fVamos_DC_Efil_DetNbr.size(); i++) + cout << "DetNbr: " << fVamos_DC_Efil_DetNbr[i] << " Energy: " << fVamos_DC_Efil_Energy[i] << endl; + + // Efil PileUp + cout << "Vamos_DC_Efil_PileUp_Mult = " << fVamos_DC_Efil_PileUp_DetNbr.size() << endl; + for (UShort_t i = 0; i < fVamos_DC_Efil_PileUp_DetNbr.size(); i++) + cout << "DetNbr: " << fVamos_DC_Efil_PileUp_DetNbr[i] << " Energy: " << fVamos_DC_Efil_PileUp_Energy[i] << endl; + + // Tfil + cout << "Vamos_DC_Tfil_Mult = " << fVamos_DC_Tfil_DetNbr.size() << endl; + for (UShort_t i = 0; i < fVamos_DC_Tfil_DetNbr.size(); i++) + cout << "DetNbr: " << fVamos_DC_Tfil_DetNbr[i] << " Time: " << fVamos_DC_Tfil_Time[i] << endl; +} diff --git a/NPLib/Vamos/TVamosDCData.h b/NPLib/Vamos/TVamosDCData.h new file mode 100644 index 000000000..b468a11d7 --- /dev/null +++ b/NPLib/Vamos/TVamosDCData.h @@ -0,0 +1,115 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : July 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class holds VAMOS Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#ifndef __VAMOSDCDATA__ +#define __VAMOSDCDATA__ + +#include <vector> + +#include "TObject.h" + + + +class TVamosDCData : public TObject { + private: + // Strips for row 1 + vector<UShort_t> fVamos_DC_Strip1_DetNbr; + vector<UShort_t> fVamos_DC_Strip1_StripNbr; + vector<UShort_t> fVamos_DC_Strip1_Energy; + + // Strips for row 2 + vector<UShort_t> fVamos_DC_Strip2_DetNbr; + vector<UShort_t> fVamos_DC_Strip2_StripNbr; + vector<UShort_t> fVamos_DC_Strip2_Energy; + + // EFil + vector<UShort_t> fVamos_DC_Efil_DetNbr; + vector<UShort_t> fVamos_DC_Efil_Energy; + + // EFil PileUp + vector<UShort_t> fVamos_DC_Efil_PileUp_DetNbr; + vector<UShort_t> fVamos_DC_Efil_PileUp_Energy; + + // TFil + vector<UShort_t> fVamos_DC_Tfil_DetNbr; + vector<UShort_t> fVamos_DC_Tfil_Time; + + public: + TVamosDCData(); + virtual ~TVamosDCData(); + + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + ///////////////////// SETTERS //////////////////////// + // Strips for row 1 + void SetVamosDCDetNbr1(UShort_t DetNbr1) {fVamos_DC_Strip1_DetNbr.push_back(DetNbr1);} + void SetVamosDCStripNbr1(UShort_t StripNbr1) {fVamos_DC_Strip1_StripNbr.push_back(StripNbr1);} + void SetVamosDCEnergy1(UShort_t Energy1) {fVamos_DC_Strip1_Energy.push_back(Energy1);} + // Strips for row 2 + void SetVamosDCDetNbr2(UShort_t DetNbr2) {fVamos_DC_Strip2_DetNbr.push_back(DetNbr2);} + void SetVamosDCStripNbr2(UShort_t StripNbr2) {fVamos_DC_Strip2_StripNbr.push_back(StripNbr2);} + void SetVamosDCEnergy2(UShort_t Energy2) {fVamos_DC_Strip2_Energy.push_back(Energy2);} + + // E fil + void SetVamosDCEfilDetNbr(UShort_t DetNbr) {fVamos_DC_Efil_DetNbr.push_back(DetNbr);} + void SetVamosDCEfilEnergy(UShort_t Energy) {fVamos_DC_Efil_Energy.push_back(Energy);} + + // E fil PileUp + void SetVamosDCEfilPileUpDetNbr(UShort_t DetNbr) {fVamos_DC_Efil_PileUp_DetNbr.push_back(DetNbr);} + void SetVamosDCEfilPileUpEnergy(UShort_t Energy) {fVamos_DC_Efil_PileUp_Energy.push_back(Energy);} + + // T fil + void SetVamosDCTfilDetNbr(UShort_t DetNbr) {fVamos_DC_Tfil_DetNbr.push_back(DetNbr);} + void SetVamosDCTfilTime(UShort_t Time) {fVamos_DC_Tfil_Time.push_back(Time);} + + ///////////////////// GETTERS //////////////////////// + // Strips for row 1 + UShort_t GetVamosDCMultStrip1() {return fVamos_DC_Strip1_DetNbr.size();} + UShort_t GetVamosDCDetNbr1(Int_t i) {return fVamos_DC_Strip1_DetNbr.at(i);} + UShort_t GetVamosDCStripNbr1(Int_t i) {return fVamos_DC_Strip1_StripNbr.at(i);} + UShort_t GetVamosDCEnergy1(Int_t i) {return fVamos_DC_Strip1_Energy.at(i);} + // Strips for row 2 + UShort_t GetVamosDCMultStrip2() {return fVamos_DC_Strip2_DetNbr.size();} + UShort_t GetVamosDCDetNbr2(Int_t i) {return fVamos_DC_Strip2_DetNbr.at(i);} + UShort_t GetVamosDCStripNbr2(Int_t i) {return fVamos_DC_Strip2_StripNbr.at(i);} + UShort_t GetVamosDCEnergy2(Int_t i) {return fVamos_DC_Strip2_Energy.at(i);} + + // E fil + UShort_t GetVamosDCEfilMult() {return fVamos_DC_Efil_DetNbr.size();} + UShort_t GetVamosDCEfilDetNbr(Int_t i) {return fVamos_DC_Efil_DetNbr.at(i);} + UShort_t GetVamosDCEfilEnergy(Int_t i) {return fVamos_DC_Efil_Energy.at(i);} + + // E fil PileUp + UShort_t GetVamosDCEfilPileUpMult() {return fVamos_DC_Efil_PileUp_DetNbr.size();} + UShort_t GetVamosDCEfilPileUpDetNbr(Int_t i) {return fVamos_DC_Efil_PileUp_DetNbr.at(i);} + UShort_t GetVamosDCEfilPileUpEnergy(Int_t i) {return fVamos_DC_Efil_PileUp_Energy.at(i);} + + // T fil + UShort_t GetVamosDCTfilMult() {return fVamos_DC_Tfil_DetNbr.size();} + UShort_t GetVamosDCTfilDetNbr(Int_t i) {return fVamos_DC_Tfil_DetNbr.at(i);} + UShort_t GetVamosDCTfilTime(Int_t i) {return fVamos_DC_Tfil_Time.at(i);} + + ClassDef(TVamosDCData,1) // VamosDCData structure +}; + +#endif diff --git a/NPLib/Vamos/TVamosFingerData.cxx b/NPLib/Vamos/TVamosFingerData.cxx new file mode 100644 index 000000000..b199040e0 --- /dev/null +++ b/NPLib/Vamos/TVamosFingerData.cxx @@ -0,0 +1,58 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : July 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class holds VAMOS Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#include <iostream> +using namespace std; + +#include "TVamosFingerData.h" + + +ClassImp(TVamosFingerData) + +TVamosFingerData::TVamosFingerData() +{ + // Default constructor + Clear(); +} + + + +TVamosFingerData::~TVamosFingerData() +{ +} + + + +void TVamosFingerData::Clear() +{ + fVamos_Finger_Energy = 0; +} + + + +void TVamosFingerData::Dump() const +{ + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; + + // VamosFinger + // (E) + cout << "Vamos_Finger_Energy = " << fVamos_Finger_Energy << endl; +} diff --git a/NPLib/Vamos/TVamosFingerData.h b/NPLib/Vamos/TVamosFingerData.h new file mode 100644 index 000000000..7c4a468e3 --- /dev/null +++ b/NPLib/Vamos/TVamosFingerData.h @@ -0,0 +1,55 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : July 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class holds VAMOS Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#ifndef __VAMOSFINGERDATA__ +#define __VAMOSFINGERDATA__ + +#include <vector> + +#include "TObject.h" + + + +class TVamosFingerData : public TObject { + private: + // ADC + UShort_t fVamos_Finger_Energy; + + public: + TVamosFingerData(); + virtual ~TVamosFingerData(); + + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + ///////////////////// GETTERS //////////////////////// + // (E) + UShort_t GetFingerEnergy() {return fVamos_Finger_Energy;} + + ///////////////////// SETTERS //////////////////////// + // (E) + void SetFingerEnergy(UShort_t E) {fVamos_Finger_Energy = E;} + + ClassDef(TVamosFingerData,1) // VamosFingerData structure +}; + +#endif diff --git a/NPLib/Vamos/TVamosPlasticData.cxx b/NPLib/Vamos/TVamosPlasticData.cxx new file mode 100644 index 000000000..d89e3aad5 --- /dev/null +++ b/NPLib/Vamos/TVamosPlasticData.cxx @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : July 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class holds VAMOS Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#include <iostream> +using namespace std; + +#include "TVamosPlasticData.h" + + +ClassImp(TVamosPlasticData) + +TVamosPlasticData::TVamosPlasticData() +{ + // Default constructor + Clear(); +} + + + +TVamosPlasticData::~TVamosPlasticData() +{ +} + + + +void TVamosPlasticData::Clear() +{ + fVamos_Plastic_Energy_Left = 0; + fVamos_Plastic_Energy_Right = 0; + fVamos_Plastic_Time_LeftRight = 0; +} + + + +void TVamosPlasticData::Dump() const +{ + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; + + // Vamos Plastic + // (E) + cout << "Vamos_Plastic_Energy_Left = " << fVamos_Plastic_Energy_Left << endl; + cout << "Vamos_Plastic_Energy_Right = " << fVamos_Plastic_Energy_Right << endl; + cout << "Vamos_Plastic_Time_LeftRight = " << fVamos_Plastic_Time_LeftRight << endl; +} diff --git a/NPLib/Vamos/TVamosPlasticData.h b/NPLib/Vamos/TVamosPlasticData.h new file mode 100644 index 000000000..afc123503 --- /dev/null +++ b/NPLib/Vamos/TVamosPlasticData.h @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : July 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class holds VAMOS Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#ifndef __VAMOSPLASTICDATA__ +#define __VAMOSPLASTICDATA__ + +#include <vector> + +#include "TObject.h" + + + +class TVamosPlasticData : public TObject { + private: + // ADC + UShort_t fVamos_Plastic_Energy_Left; + UShort_t fVamos_Plastic_Energy_Right; + UShort_t fVamos_Plastic_Time_LeftRight; + + public: + TVamosPlasticData(); + virtual ~TVamosPlasticData(); + + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + ///////////////////// GETTERS //////////////////////// + // (E) + UShort_t GetEnergyLeft() {return fVamos_Plastic_Energy_Left;} + UShort_t GetEnergyRight() {return fVamos_Plastic_Energy_Right;} + UShort_t GetTimeLeftRight() {return fVamos_Plastic_Time_LeftRight;} + + ///////////////////// SETTERS //////////////////////// + // (E) + void SetEnergyLeft(UShort_t E) {fVamos_Plastic_Energy_Left = E;} + void SetEnergyRight(UShort_t E) {fVamos_Plastic_Energy_Right = E;} + void SetTimeLeftRight(UShort_t E) {fVamos_Plastic_Time_LeftRight = E;} + + ClassDef(TVamosPlasticData,1) // VamosPlasticData structure +}; + +#endif -- GitLab