From 2e35278ec88ba3cad47dea28b267bd870da473f7 Mon Sep 17 00:00:00 2001 From: adrien matta <matta@lpccaen.in2p3.fr> Date: Mon, 2 Oct 2017 14:32:38 +0200 Subject: [PATCH] * Adding modular leaf detector class - allow to add leaf as input/output from the detector file - calibration is supported with a token having the name of the leaf --- NPLib/Detectors/ModularLeaf/CMakeLists.txt | 4 + .../ModularLeaf/TModularLeafPhysics.cxx | 181 +++++++++++++++ .../ModularLeaf/TModularLeafPhysics.h | 98 ++++++++ Projects/e748/Analysis.cxx | 192 +++++++++++----- Projects/e748/Analysis.h | 41 +++- .../Calibration/Energy/EnergyCalibrator.h | 6 +- .../Calibration/Energy/ExtractRawHisto_E.C | 3 +- .../e748/Calibration/Energy/RunToTreat.txt | 17 +- Projects/e748/configs/ConfigMust2.dat | 81 ++++++- Projects/e748/e748.detector | 216 ++++++++++-------- Projects/e748/offline/GUser.cxx | 59 +++-- Projects/e748/offline/GUser.h | 4 +- Projects/e748/offline/Makefile | 82 +++---- Projects/e748/offline/Offline.cxx | 81 +++++-- Projects/e748/online/GUser.cxx | 30 ++- Projects/e748/online/GUser.h | 2 + Projects/e748/online/Online.cxx | 29 ++- 17 files changed, 849 insertions(+), 277 deletions(-) create mode 100644 NPLib/Detectors/ModularLeaf/CMakeLists.txt create mode 100644 NPLib/Detectors/ModularLeaf/TModularLeafPhysics.cxx create mode 100644 NPLib/Detectors/ModularLeaf/TModularLeafPhysics.h mode change 100755 => 100644 Projects/e748/configs/ConfigMust2.dat mode change 100755 => 100644 Projects/e748/e748.detector diff --git a/NPLib/Detectors/ModularLeaf/CMakeLists.txt b/NPLib/Detectors/ModularLeaf/CMakeLists.txt new file mode 100644 index 000000000..89ce7b70c --- /dev/null +++ b/NPLib/Detectors/ModularLeaf/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library(NPModularLeaf SHARED TModularLeafPhysics.cxx) +target_link_libraries(NPModularLeaf ${ROOT_LIBRARIES} NPCore) +install(FILES TModularLeafPhysics.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) + diff --git a/NPLib/Detectors/ModularLeaf/TModularLeafPhysics.cxx b/NPLib/Detectors/ModularLeaf/TModularLeafPhysics.cxx new file mode 100644 index 000000000..a482a8962 --- /dev/null +++ b/NPLib/Detectors/ModularLeaf/TModularLeafPhysics.cxx @@ -0,0 +1,181 @@ +/***************************************************************************** + * Copyright (C) 2009-2016 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: Adrien MATTA contact address: matta@lpccaen.in2p3.fr * + * * + * Creation Date : november 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold ModularLeaf Physics * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ + +// NPL +#include "TModularLeafPhysics.h" +#include "RootOutput.h" +#include "RootInput.h" +#include "NPDetectorFactory.h" +#include "NPOptionManager.h" + +// STL +#include <iostream> +#include <sstream> +#include <fstream> +#include <limits> +#include <stdlib.h> +using namespace std; + +// ROOT +#include "TChain.h" + +// tranform an integer to a string +string itoa(int value){ + char buffer [33]; + sprintf(buffer,"%d",value); + return buffer; +} + +ClassImp(TModularLeafPhysics) + /////////////////////////////////////////////////////////////////////////// +TModularLeafPhysics::TModularLeafPhysics(){ + NumberOfDetector = 0 ; + //EventData = new TModularLeafData ; + EventPhysics = this ; +} + +/////////////////////////////////////////////////////////////////////////// +TModularLeafPhysics::~TModularLeafPhysics(){ + } + +/////////////////////////////////////////////////////////////////////////// +void TModularLeafPhysics::Clear() { + std::map<std::string,double>::iterator it ; + for( it=m_CalibratedData.begin();it!=m_CalibratedData.end();it++){ + it->second=m_DefaultValue; + } +} +/////////////////////////////////////////////////////////////////////////// +void TModularLeafPhysics::ClearEventData() { + std::map<std::string,short>::iterator it ; + for( it=m_RawData.begin();it!=m_RawData.end();it++){ + it->second=m_DefaultValue; + } +} + + +/////////////////////////////////////////////////////////////////////////// +void TModularLeafPhysics::ReadConfiguration(NPL::InputParser parser) { + vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("ModularLeaf"); + if(NPOptionManager::getInstance()->GetVerboseLevel()) + cout << "//// " << blocks.size() << " modular leafs blocks found " << endl; + + vector<string> token = {"Leafs","DefaultValue"}; + + for(unsigned int i = 0 ; i < blocks.size() ; i++){ + if(blocks[i]->HasTokenList(token)){ + if(NPOptionManager::getInstance()->GetVerboseLevel()) + cout << endl << "//// ModularLeaf " << i+1 << endl; + + m_DefaultValue = blocks[i]->GetDouble("DefaultValue","void"); + std::vector<std::string> leafs = blocks[i]->GetVectorString("Leafs"); + unsigned int size = leafs.size(); + for(unsigned int l = 0 ; l < size ; l++){ + m_CalibratedData[leafs[l]] = m_DefaultValue; + m_RawData[leafs[l]] = m_DefaultValue; + } + } + + else{ + cout << "ERROR: check your input file formatting " << endl; + exit(1); + } + } +} + +/////////////////////////////////////////////////////////////////////////// +void TModularLeafPhysics::AddParameterToCalibrationManager(){ + CalibrationManager* Cal = CalibrationManager::getInstance(); + std::map<std::string,double>::iterator it; + for(it = m_CalibratedData.begin() ; it!=m_CalibratedData.end() ; it++) + Cal->AddParameter("ModularLeaf", it->first,it->first) ; +} + +/////////////////////////////////////////////////////////////////////////// +void TModularLeafPhysics::InitializeRootInputRaw() { + TChain* inputChain = RootInput::getInstance()->GetChain(); + std::map<std::string,short>::iterator it; + for(it = m_RawData.begin() ; it!=m_RawData.end() ; it++){ + inputChain->SetBranchStatus ( (it->first).c_str(), true ); + inputChain->SetBranchAddress( (it->first).c_str(), &(it->second) ) ; + } +} +/////////////////////////////////////////////////////////////////////////// +void TModularLeafPhysics::InitializeRootInputPhysics(){ + TChain* inputChain = RootInput::getInstance()->GetChain(); + std::map<std::string,double>::iterator it; + for(it = m_CalibratedData.begin() ; it!=m_CalibratedData.end() ; it++){ + inputChain->SetBranchStatus ( (it->first).c_str(), true ); + inputChain->SetBranchAddress( (it->first).c_str(), &(it->second) ) ; + } +} + +/////////////////////////////////////////////////////////////////////////// +void TModularLeafPhysics::InitializeRootOutput(){ + TTree* outputTree = RootOutput::getInstance()->GetTree(); + std::map<std::string,double>::iterator it; + for(it = m_CalibratedData.begin() ; it!=m_CalibratedData.end() ; it++){ + outputTree->Branch( (it->first).c_str(), &(m_CalibratedData[it->first])) ; + } +} + +/////////////////////////////////////////////////////////////////////////// +void TModularLeafPhysics::BuildPhysicalEvent(){ + static CalibrationManager* Cal = CalibrationManager::getInstance(); + std::map<std::string,short>::iterator it; + + for(it = m_RawData.begin() ; it != m_RawData.end() ; it++){ + if(it->second!=m_DefaultValue){ + static string param; + param="ModularLeaf/"+it->first; + m_CalibratedData[it->first] = Cal->ApplyCalibration(param,it->second); + } + } +} + +/////////////////////////////////////////////////////////////////////////// +void TModularLeafPhysics::BuildSimplePhysicalEvent(){ + +} + +//////////////////////////////////////////////////////////////////////////////// +// Construct Method to be pass to the DetectorFactory // +//////////////////////////////////////////////////////////////////////////////// +NPL::VDetector* TModularLeafPhysics::Construct(){ + return (NPL::VDetector*) new TModularLeafPhysics(); +} + +//////////////////////////////////////////////////////////////////////////////// +// Registering the construct method to the factory // +//////////////////////////////////////////////////////////////////////////////// +extern "C"{ +class proxy_modularleaf{ + public: + proxy_modularleaf(){ + NPL::DetectorFactory::getInstance()->AddToken("ModularLeaf","ModularLeaf"); + NPL::DetectorFactory::getInstance()->AddDetector("ModularLeaf",TModularLeafPhysics::Construct); + } +}; + +proxy_modularleaf p; +} + diff --git a/NPLib/Detectors/ModularLeaf/TModularLeafPhysics.h b/NPLib/Detectors/ModularLeaf/TModularLeafPhysics.h new file mode 100644 index 000000000..3bcddfac2 --- /dev/null +++ b/NPLib/Detectors/ModularLeaf/TModularLeafPhysics.h @@ -0,0 +1,98 @@ +#ifndef __ModularLeafPhysics__ +#define __ModularLeafPhysics__ +/***************************************************************************** + * Copyright (C) 2009-2016 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: Adrien MATTA contact address: a.matta@surrey.ac.uk * + * * + * Creation Date : November 2009 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold theModularLeaf Detector Physics * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ + +// STL +#include <vector> +using namespace std ; + +// ROOT +#include "TObject.h" + +// NPL +#include "NPVDetector.h" +#include "NPCalibrationManager.h" +#include "NPInputParser.h" + +class TModularLeafPhysics : public TObject, public NPL::VDetector{ + public: // Constructor and Destructor + TModularLeafPhysics(); + ~TModularLeafPhysics(); + + public: + void Clear(); + void Clear(const Option_t*) {}; + + private: // Raw and Calibrated Data + double m_DefaultValue; // ! + std::map<std::string,double> m_CalibratedData; + std::map<std::string,short> m_RawData; + + public: // inherrited from VDetector + // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token + void ReadConfiguration(NPL::InputParser); + + + // 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. 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(); + + // Same as above but for online analysis + void BuildOnlinePhysicalEvent() {BuildPhysicalEvent();}; + + // Give and external TModularLeafData object to TModularLeafPhysics. Needed for online analysis for example. + void SetRawDataPointer(void* rawDataPointer) {} + + // Those two method all to clear the Event Physics or Data + void ClearEventPhysics() {Clear();} + void ClearEventData() ; + + private: // Data not writted in the tree + int NumberOfDetector ;//! + //TModularLeafData* EventData ;//! + TModularLeafPhysics* EventPhysics ;//! + + public: // Static constructor to be passed to the Detector Factory + static NPL::VDetector* Construct(); + ClassDef(TModularLeafPhysics,1) // ModularLeafPhysics structure +}; + +#endif diff --git a/Projects/e748/Analysis.cxx b/Projects/e748/Analysis.cxx index 5d0a76761..a66d024f8 100644 --- a/Projects/e748/Analysis.cxx +++ b/Projects/e748/Analysis.cxx @@ -37,10 +37,13 @@ Analysis::~Analysis(){ //////////////////////////////////////////////////////////////////////////////// void Analysis::Init(){ M2= (TMust2Physics*) m_DetectorManager->GetDetector("M2Telescope"); - Initial=new TInitialConditions(); + CATS= ( TCATSPhysics*) m_DetectorManager->GetDetector("CATSDetector"); + + //Initial=new TInitialConditions(); + InitOutputBranch(); InitInputBranch(); - Rand = TRandom3(); + /* Rand = TRandom3(); */ myReaction= new NPL::Reaction(); myReaction->ReadConfigurationFile(NPOptionManager::getInstance()->GetReactionFile()); DetectorNumber = 0 ; @@ -56,9 +59,10 @@ void Analysis::Init(){ Si_X_M2 = 0; Si_Y_M2 = 0; ZTarget = 0; + TimeCorr=0; TargetThickness = m_DetectorManager->GetTargetThickness(); // Energy loss table: the G4Table are generated by the simulation - He3CD2 = EnergyLoss("Example/He3_CD2.G4table","G4Table",100 ); + He3CD2 = EnergyLoss("Example/He3_CD2.G4table","G4Table",101 ); He3Al = EnergyLoss("Example/He3_Al.G4table","G4Table",10); He3Si = EnergyLoss("Example/He3_Si.G4table","G4Table",10); //Li11CD2 = EnergyLoss("ExampleLi11_CD2.G4table","G4Table",100); @@ -72,45 +76,58 @@ void Analysis::TreatEvent(){ // and apply by hand the experimental resolution // This is because the beam diagnosis are not simulated // PPAC position resolution on target is assumed to be 1mm - double XTarget = Rand.Gaus(Initial->GetIncidentPositionX(),1); - double YTarget = Rand.Gaus(Initial->GetIncidentPositionY(),1); - TVector3 BeamDirection = Initial->GetBeamDirection(); + double XTarget = CATS->GetPositionOnTarget().X(); + double YTarget = CATS->GetPositionOnTarget().Y(); + + TVector3 BeamDirection = CATS->GetBeamDirection(); // Beam energy is measured using F3 and F2 plastic TOF - double BeamEnergy = Rand.Gaus(Initial->GetIncidentInitialKineticEnergy(),4.5); + //double BeamEnergy= myReaction-> GetBeamEnergy()* MeV; + double BeamEnergy= 30*12* MeV; //BeamEnergy = Li11CD2.Slow(BeamEnergy,TargetThickness/2.,0); - OriginalThetaLab = Initial->GetThetaCM(0); - OriginalELab = Initial->GetKineticEnergy(0); myReaction->SetBeamEnergy(BeamEnergy); //////////////////////////// LOOP on MUST2 Hit ////////////////// - for(unsigned int countMust2 = 0 ; countMust2 < M2->Si_E.size() ; countMust2++){ - /************************************************/ - //Part 0 : Get the usefull Data - // MUST2 - int X = M2->Si_X[countMust2]; - int Y = M2->Si_Y[countMust2]; - int TelescopeNumber = M2->TelescopeNumber[countMust2]; + for(unsigned int countMust2 = 0 ; countMust2 < M2->Si_E.size() ; countMust2++){ + /* //Part 0 : Get the usefull Data */ + // MUST2 */ + int X = M2->Si_X[countMust2]; + int Y = M2->Si_Y[countMust2]; + int TelescopeNumber = M2->TelescopeNumber[countMust2]; Si_X_M2 = X ; Si_Y_M2 = Y ; - /************************************************/ - // Forward Telescope Only - if(TelescopeNumber<5){ + /* // Forward Telescope Only */ + // if(TelescopeNumber<6){ + /* // All Telescopes */ + if(TelescopeNumber<9){ + // if(TelescopeNumber<6){ DetectorNumber = TelescopeNumber ; - /************************************************/ - // Part 1 : Impact Angle + + /* // Part 1 : Impact Angle */ ThetaM2Surface = 0; ThetaNormalTarget = 0; if(XTarget>-1000 && YTarget>-1000){ TVector3 BeamImpact(XTarget,YTarget,0); + //TVector3 BeamImpact(0,0,0); + TVector3 HitDirection = M2 -> GetPositionOfInteraction(countMust2) - BeamImpact ; ThetaLab = HitDirection.Angle( BeamDirection ); + + ThetaM2Surface = HitDirection.Angle(- M2 -> GetTelescopeNormal(countMust2) ); ThetaNormalTarget = HitDirection.Angle( TVector3(0,0,1) ) ; X_M2 = M2 -> GetPositionOfInteraction(countMust2).X() ; Y_M2 = M2 -> GetPositionOfInteraction(countMust2).Y() ; Z_M2 = M2 -> GetPositionOfInteraction(countMust2).Z() ; - } + static double BeamSpeed = 74.2;// mm per nano + static double ZCats1 = 1458; //mm + BeamLength = ZCats1/(1-sin(BeamDirection.Angle(TVector3(0,0,1)))); + ParticleLength = HitDirection.Mag(); + TimeCorr=BeamLength/BeamSpeed ; + + + } + else{ BeamDirection = TVector3(-1000,-1000,-1000); @@ -118,50 +135,46 @@ void Analysis::TreatEvent(){ ThetaNormalTarget = -1000 ; } - /************************************************/ - - /************************************************/ - // Part 2 : Impact Energy +/* // Part 2 : Impact Energy */ Energy = ELab = E_M2 = 0; Si_E_M2 = M2->Si_E[countMust2]; CsI_E_M2= M2->CsI_E[countMust2]; - // if CsI - if(CsI_E_M2>0 ){ - // The energy in CsI is calculate form dE/dx Table because - // 20um resolution is poor - Energy = - He3Si.EvaluateEnergyFromDeltaE(Si_E_M2,300*micrometer, - ThetaM2Surface, 0.01*MeV, - 450.*MeV,0.001*MeV ,1000); - E_M2=CsI_E_M2; - } +/* // if CsI */ +/* /1* if(CsI_E_M2>0 ){ *1/ */ +/* /1* // The energy in CsI is calculate form dE/dx Table because *1/ */ +/* /1* // 20um resolution is poor *1/ */ +/* /1* Energy = *1/ */ +/* /1* He3Si.EvaluateEnergyFromDeltaE(Si_E_M2,300*micrometer, *1/ */ +/* /1* ThetaM2Surface, 0.01*MeV, *1/ */ +/* /1* 450.*MeV,0.001*MeV ,1000); *1/ */ +/* /1* E_M2=CsI_E_M2; *1/ */ +/* /1* } *1/ */ - else - Energy = Si_E_M2; +/* /1* else *1/ */ + + + + + Energy = Si_E_M2; E_M2 += Si_E_M2; - // Evaluate energy using the thickness +/* // Evaluate energy using the thickness */ ELab = He3Al.EvaluateInitialEnergy( Energy,0.4*micrometer , ThetaM2Surface); - // Target Correction +/* // Target Correction */ ELab = He3CD2.EvaluateInitialEnergy( ELab ,TargetThickness/2., ThetaNormalTarget); - /************************************************/ - /************************************************/ - // Part 3 : Excitation Energy Calculation +/* // Part 3 : Excitation Energy Calculation */ Ex = myReaction -> ReconstructRelativistic( ELab , ThetaLab ); - /************************************************/ - /************************************************/ - // Part 4 : Theta CM Calculation +/* // Part 4 : Theta CM Calculation */ ThetaCM = myReaction -> EnergyLabToThetaCM( ELab , ThetaLab)/deg; ThetaLab=ThetaLab/deg; - /************************************************/ - - } + + } }//end loop MUST2 } @@ -171,21 +184,85 @@ void Analysis::End(){ //////////////////////////////////////////////////////////////////////////////// void Analysis::InitOutputBranch() { + RootOutput::getInstance()->GetTree()->Branch("X_M2",&X_M2,"X_M2/D"); + RootOutput::getInstance()->GetTree()->Branch("Y_M2",&Y_M2,"Y_M2/D"); RootOutput::getInstance()->GetTree()->Branch("Ex",&Ex,"Ex/D"); - RootOutput::getInstance()->GetTree()->Branch("ELab",&ELab,"ELab/D"); RootOutput::getInstance()->GetTree()->Branch("ThetaLab",&ThetaLab,"ThetaLab/D"); RootOutput::getInstance()->GetTree()->Branch("ThetaCM",&ThetaCM,"ThetaCM/D"); - RootOutput::getInstance()->GetTree()->Branch("OriginalThetaLab",&OriginalThetaLab,"OriginalThetaLab/D"); - RootOutput::getInstance()->GetTree()->Branch("OriginalELab",&OriginalELab,"OriginalELab/D"); - + /* RootOutput::getInstance()->GetTree()->Branch("OriginalThetaLab",&OriginalThetaLab,"OriginalThetaLab/D"); */ + RootOutput::getInstance()->GetTree()->Branch("ELab",&ELab,"ELab/D"); + RootOutput::getInstance()->GetTree()->Branch("TimeCorr",&TimeCorr,"TimeCorr/D"); + RootOutput::getInstance()->GetTree()->Branch("BeamLength",&BeamLength,"BeamLength/D"); + RootOutput::getInstance()->GetTree()->Branch("ParticleLength",&ParticleLength,"ParticleLength/D"); + RootOutput::getInstance()->GetTree()->Branch("GATCONF",&vGATCONF,"GATCONF/s"); +/* RootOutput::getInstance()->GetTree()->Branch("ADC_CHIO_V15",&vADC_CHIO_V15,"ADC_CHIO_V15/s"); + RootOutput::getInstance()->GetTree()->Branch("ADC_VOIE_29",&vADC_VOIE_29,"ADC_VOIE_29/s"); + RootOutput::getInstance()->GetTree()->Branch("CHIO",&vCHIO,"CHIO/s"); + RootOutput::getInstance()->GetTree()->Branch("CONFDEC",&vCONFDEC,"CONFDEC/s"); + RootOutput::getInstance()->GetTree()->Branch("CONFDEC_AGAVA",&vCONFDEC_AGAVA,"CONFDEC_AGAVA/s"); + RootOutput::getInstance()->GetTree()->Branch("DATATRIG",&vDATATRIG,"DATATRIG/s"); + RootOutput::getInstance()->GetTree()->Branch("DATATRIG_CHIO",&vDATATRIG_CHIO,"DATATRIG_CHIO/s"); + RootOutput::getInstance()->GetTree()->Branch("E1D6",&vE1D6,"E1D6/s"); + RootOutput::getInstance()->GetTree()->Branch("E2D6",&vE2D6,"E2D6/s"); + RootOutput::getInstance()->GetTree()->Branch("ED4",&vED4,"ED4/s"); + RootOutput::getInstance()->GetTree()->Branch("EXL_HF",&vEXL_HF,"EXL_HF/s"); + RootOutput::getInstance()->GetTree()->Branch("GALD4X",&vGALD4X,"GALD4X/s"); + RootOutput::getInstance()->GetTree()->Branch("GALD4Y",&vGALD4Y,"GALD4Y/s"); + RootOutput::getInstance()->GetTree()->Branch("QCaviar",&vQCaviar,"QCaviar/s"); + RootOutput::getInstance()->GetTree()->Branch("QPlast",&vQPlast,"QPlast/s"); + RootOutput::getInstance()->GetTree()->Branch("TCAVHF",&vTCAVHF,"TCAVHF/s"); + RootOutput::getInstance()->GetTree()->Branch("TE1D6CAV",&vTE1D6CAV,"TE1D6CAV/s"); + RootOutput::getInstance()->GetTree()->Branch("TE1D6GAL",&vTE1D6GAL,"TE1D6GAL/s"); + RootOutput::getInstance()->GetTree()->Branch("TE1D6HF",&vTE1D6HF,"TE1D6HF/s"); + RootOutput::getInstance()->GetTree()->Branch("TED4HF",&vTED4HF,"TED4HF/s"); + RootOutput::getInstance()->GetTree()->Branch("TGALD4HF",&vTGALD4HF,"TGALD4HF/s"); + RootOutput::getInstance()->GetTree()->Branch("T_CATS1_2",&vT_CATS1_2,"T_CATS1_2/s"); + RootOutput::getInstance()->GetTree()->Branch("T_CATS1_CAV",&vT_CATS1_CAV,"T_CATS1_CAV/s"); + RootOutput::getInstance()->GetTree()->Branch("T_MUVI_CATS1",&vT_MUVI_CATS1,"T_MUVI_CATS1/s"); + RootOutput::getInstance()->GetTree()->Branch("T_PL_CATS1",&vT_PL_CATS1,"T_PL_CATS1/s"); + RootOutput::getInstance()->GetTree()->Branch("T_PL_CATS2",&vT_PL_CATS2,"T_PL_CATS2/s"); + RootOutput::getInstance()->GetTree()->Branch("T_PL_CHIO",&vT_PL_CHIO,"T_PL_CHIO/s"); + RootOutput::getInstance()->GetTree()->Branch("T_PLchCATS1",&vT_PLchCATS1,"T_PLchCATS1/s"); +*/ } //////////////////////////////////////////////////////////////////////////////// void Analysis::InitInputBranch(){ - RootInput:: getInstance()->GetChain()->SetBranchStatus("InitialConditions",true ); - RootInput:: getInstance()->GetChain()->SetBranchStatus("fIC_*",true ); - RootInput:: getInstance()->GetChain()->SetBranchAddress("InitialConditions",&Initial); + /* RootInput:: getInstance()->GetChain()->SetBranchStatus("InitialConditions",true ); */ + /* RootInput:: getInstance()->GetChain()->SetBranchStatus("fIC_*",true ); */ + /* RootInput:: getInstance()->GetChain()->SetBranchStatus("InitialConditions",true ); */ + + RootInput:: getInstance()->GetChain()->SetBranchAddress("GATCONF",&vGATCONF); + /* RootInput:: getInstance()->GetChain()->SetBranchAddress("ADC_CHIO_V15",&vADC_CHIO_V15); + RootInput:: getInstance()->GetChain()->SetBranchAddress("ADC_VOIE_29",&vADC_VOIE_29); + RootInput:: getInstance()->GetChain()->SetBranchAddress("CHIO",&vCHIO); + RootInput:: getInstance()->GetChain()->SetBranchAddress("CONFDEC",&vCONFDEC); + RootInput:: getInstance()->GetChain()->SetBranchAddress("CONFDEC_AGAVA",&vCONFDEC_AGAVA); + RootInput:: getInstance()->GetChain()->SetBranchAddress("DATATRIG",&vDATATRIG); + RootInput:: getInstance()->GetChain()->SetBranchAddress("DATATRIG_CHIO",&vDATATRIG_CHIO); + RootInput:: getInstance()->GetChain()->SetBranchAddress("E1D6",&vE1D6); + RootInput:: getInstance()->GetChain()->SetBranchAddress("E2D6",&vE2D6); + RootInput:: getInstance()->GetChain()->SetBranchAddress("ED4",&vED4); + RootInput:: getInstance()->GetChain()->SetBranchAddress("EXL_HF",&vEXL_HF); + RootInput:: getInstance()->GetChain()->SetBranchAddress("GALD4X",&vGALD4X); + RootInput:: getInstance()->GetChain()->SetBranchAddress("GALD4Y",&vGALD4Y); + RootInput:: getInstance()->GetChain()->SetBranchAddress("QCaviar",&vQCaviar); + RootInput:: getInstance()->GetChain()->SetBranchAddress("QPlast",&vQPlast); + RootInput:: getInstance()->GetChain()->SetBranchAddress("TCAVHF",&vTCAVHF); + RootInput:: getInstance()->GetChain()->SetBranchAddress("TE1D6CAV",&vTE1D6CAV); + RootInput:: getInstance()->GetChain()->SetBranchAddress("TE1D6GAL",&vTE1D6GAL); + RootInput:: getInstance()->GetChain()->SetBranchAddress("TE1D6HF",&vTE1D6HF); + RootInput:: getInstance()->GetChain()->SetBranchAddress("TED4HF",&vTED4HF); + RootInput:: getInstance()->GetChain()->SetBranchAddress("TGALD4HF",&vTGALD4HF); + RootInput:: getInstance()->GetChain()->SetBranchAddress("T_CATS1_2",&vT_CATS1_2); + RootInput:: getInstance()->GetChain()->SetBranchAddress("T_CATS1_CAV",&vT_CATS1_CAV); + RootInput:: getInstance()->GetChain()->SetBranchAddress("T_MUVI_CATS1",&vT_MUVI_CATS1); + RootInput:: getInstance()->GetChain()->SetBranchAddress("T_PL_CATS1",&vT_PL_CATS1); + RootInput:: getInstance()->GetChain()->SetBranchAddress("T_PL_CATS2",&vT_PL_CATS2); + RootInput:: getInstance()->GetChain()->SetBranchAddress("T_PL_CHIO",&vT_PL_CHIO); + RootInput:: getInstance()->GetChain()->SetBranchAddress("T_PLchCATS1",&vT_PLchCATS1); +*/ } //////////////////////////////////////////////////////////////////////////////// @@ -196,6 +273,9 @@ void Analysis::ReInitValue(){ ThetaCM = -1000; OriginalThetaLab = -1000; OriginalELab = -1000; + TimeCorr=-1000; + BeamLength=-1000; + ParticleLength=-1000; } //////////////////////////////////////////////////////////////////////////////// diff --git a/Projects/e748/Analysis.h b/Projects/e748/Analysis.h index 8e3cc283c..c614c7ae4 100644 --- a/Projects/e748/Analysis.h +++ b/Projects/e748/Analysis.h @@ -23,7 +23,8 @@ *****************************************************************************/ #include"NPVAnalysis.h" #include "TMust2Physics.h" -#include "TInitialConditions.h" +#include "TCATSPhysics.h" + #include "TInitialConditions.h" #include "NPEnergyLoss.h" #include "NPReaction.h" #include "TRandom3.h" @@ -63,6 +64,9 @@ class Analysis: public NPL::VAnalysis{ double Si_X_M2; double Si_Y_M2; double ZTarget; + double TimeCorr; + double BeamLength; + double ParticleLength; double TargetThickness; double OriginalThetaLab; double OriginalELab; @@ -72,6 +76,39 @@ class Analysis: public NPL::VAnalysis{ NPL::EnergyLoss Li11CD2 ; TMust2Physics* M2; - TInitialConditions* Initial; + TCATSPhysics* CATS; + TInitialConditions* Initial; + //other variables + Short_t vADC_CHIO_V15; + Short_t vADC_VOIE_29; + Short_t vCHIO; + Short_t vCONFDEC; + Short_t vCONFDEC_AGAVA; + Short_t vDATATRIG; + Short_t vDATATRIG_CHIO; + Short_t vE1D6; + Short_t vE2D6; + Short_t vED4; + Short_t vEXL_HF; + Short_t vGALD4X; + Short_t vGALD4Y; + Short_t vGATCONF; + Short_t vQCaviar; + Short_t vQPlast; + Short_t vTCAVHF; + Short_t vTE1D6CAV; + Short_t vTE1D6GAL; + Short_t vTE1D6HF; + Short_t vTED4HF; + Short_t vTGALD4HF; + Short_t vT_CATS1_2; + Short_t vT_CATS1_CAV; + Short_t vT_MUVI_CATS1; + Short_t vT_PL_CATS1; + Short_t vT_PL_CATS2; + Short_t vT_PL_CHIO; + Short_t vT_PLchCATS1; + + }; #endif diff --git a/Projects/e748/Calibration/Energy/EnergyCalibrator.h b/Projects/e748/Calibration/Energy/EnergyCalibrator.h index 61e246855..b12bbba06 100644 --- a/Projects/e748/Calibration/Energy/EnergyCalibrator.h +++ b/Projects/e748/Calibration/Energy/EnergyCalibrator.h @@ -37,14 +37,14 @@ EnergyLoss EL_Al("./EnergyLossTable/alpha_Al.G4table" , "G4Table", 100) ; EnergyLoss EL_Si("./EnergyLossTable/alpha_Si.G4table" , "G4Table", 100) ; // Information about the calibration condition (use Latex marks-up) -const TString xy = "X" ; +const TString xy = "Y" ; const TString Experiment = "E748"; const TString Run_Period = "june 2017"; const TString Operator = "Freddy and the girls"; const TString Source = "3 alpha peaks $^{239}$Pu, $^{241}$Am, $^{244}$Cm"; -const TString Comment = "Source at 0$^{\\circ}$ facing Telescope 1,2,3,4"; -const char* frun = "run11"; +const TString Comment = "Source at 0$^{\\circ}$ facing Telescope 1-4"; +const char* frun = "run_0019"; //const TString Experiment = "RIBF57"; //const TString Run_Period = "April 2010, Riken BigRIPS, Run 3"; diff --git a/Projects/e748/Calibration/Energy/ExtractRawHisto_E.C b/Projects/e748/Calibration/Energy/ExtractRawHisto_E.C index d5eae414f..29d419a57 100644 --- a/Projects/e748/Calibration/Energy/ExtractRawHisto_E.C +++ b/Projects/e748/Calibration/Energy/ExtractRawHisto_E.C @@ -23,7 +23,7 @@ #define NBSTRIPS 128 #define NBSILI 16 -void ExtractMust2Histos(const char* fname = "run11") +void ExtractMust2Histos(const char* fname = "run_0019") { RootInput* Input = RootInput::getInstance("RunToTreat.txt"); @@ -45,6 +45,7 @@ void ExtractMust2Histos(const char* fname = "run11") // prepare output histograms for Must2 TH1F* hStripXEnergy[NBTELESCOPE][NBSTRIPS]; TH1F* hStripYEnergy[NBTELESCOPE][NBSTRIPS]; + //from i=4 because I wanted only the T5,T8 for (Int_t i = 0; i < NBTELESCOPE; i++) { for (Int_t j = 0; j < NBSTRIPS; j++) { // strips XE diff --git a/Projects/e748/Calibration/Energy/RunToTreat.txt b/Projects/e748/Calibration/Energy/RunToTreat.txt index 5d23f161d..47ef51cc0 100644 --- a/Projects/e748/Calibration/Energy/RunToTreat.txt +++ b/Projects/e748/Calibration/Energy/RunToTreat.txt @@ -2,5 +2,18 @@ TTreeName AutoTree RootFileName -/home/muvi/e748/nptool/Projects/e748/offline/run11.root - +/data/e748X/e748/acquisition/root/run_0019_0.root +/data/e748X/e748/acquisition/root/run_0019_1.root +/data/e748X/e748/acquisition/root/run_0019_2.root +/data/e748X/e748/acquisition/root/run_0019_3.root +/data/e748X/e748/acquisition/root/run_0019_4.root +/data/e748X/e748/acquisition/root/run_0019_5.root +/data/e748X/e748/acquisition/root/run_0019_6.root +/data/e748X/e748/acquisition/root/run_0019_7.root +/data/e748X/e748/acquisition/root/run_0019_8.root +/data/e748X/e748/acquisition/root/run_0019_9.root +/data/e748X/e748/acquisition/root/run_0019_10.root +/data/e748X/e748/acquisition/root/run_0019_11.root +/data/e748X/e748/acquisition/root/run_0019_12.root +/data/e748X/e748/acquisition/root/run_0019_13.root +/data/e748X/e748/acquisition/root/run_0019_14.root diff --git a/Projects/e748/configs/ConfigMust2.dat b/Projects/e748/configs/ConfigMust2.dat old mode 100755 new mode 100644 index 04da937f1..247888b90 --- a/Projects/e748/configs/ConfigMust2.dat +++ b/Projects/e748/configs/ConfigMust2.dat @@ -1,15 +1,74 @@ ConfigMust2 - MAX_STRIP_MULTIPLICITY 10 - STRIP_ENERGY_MATCHING_NUMBER_OF_SIGMA 5 - STRIP_ENERGY_MATCHING_SIGMA 0.02 - DISABLE_CHANNEL MM1STRY12 - DISABLE_CHANNEL MM2STRY12 - DISABLE_CHANNEL MM3STRY12 - DISABLE_CHANNEL MM4STRY12 - DISABLE_CHANNEL MM1STRX12 + MAX_STRIP_MULTIPLICITY 100 + STRIP_ENERGY_MATCHING_NUMBER_OF_SIGMA 50 + STRIP_ENERGY_MATCHING_SIGMA 0.05 + DISABLE_CHANNEL MM1STRX12 DISABLE_CHANNEL MM2STRX12 DISABLE_CHANNEL MM3STRX12 DISABLE_CHANNEL MM4STRX12 - SI_X_E_RAW_THRESHOLD 8192 - CSI_E_RAW_THRESHOLD 0 - CSI_SIZE 256 + + DISABLE_CHANNEL MM1STRY121 + DISABLE_CHANNEL MM1STRY122 + DISABLE_CHANNEL MM1STRY125 + DISABLE_CHANNEL MM1STRY126 + DISABLE_CHANNEL MM1STRY128 + + DISABLE_CHANNEL MM1STRX44 + DISABLE_CHANNEL MM1STRX120 + + DISABLE_CHANNEL MM2STRX1 + DISABLE_CHANNEL MM2STRX2 + DISABLE_CHANNEL MM2STRX3 + DISABLE_CHANNEL MM2STRX4 + DISABLE_CHANNEL MM2STRX5 + DISABLE_CHANNEL MM2STRX6 + DISABLE_CHANNEL MM2STRX7 + DISABLE_CHANNEL MM2STRX8 + DISABLE_CHANNEL MM2STRX9 + DISABLE_CHANNEL MM2STRX10 + DISABLE_CHANNEL MM2STRX11 + DISABLE_CHANNEL MM2STRX12 + DISABLE_CHANNEL MM2STRX128 + + DISABLE_CHANNEL MM2STRY1 + DISABLE_CHANNEL MM2STRY107 + DISABLE_CHANNEL MM2STRY108 + DISABLE_CHANNEL MM2STRY109 + DISABLE_CHANNEL MM2STRY128 + + DISABLE_CHANNEL MM3STRX1 + DISABLE_CHANNEL MM3STRX128 + DISABLE_CHANNEL MM3STRY128 + DISABLE_CHANNEL MM3STRY1 + + DISABLE_CHANNEL MM4STRX1 + DISABLE_CHANNEL MM4STRY90 + DISABLE_CHANNEL MM4STRY91 + DISABLE_CHANNEL MM4STRY92 + DISABLE_CHANNEL MM4STRY93 + DISABLE_CHANNEL MM4STRY94 + DISABLE_CHANNEL MM4STRY95 + DISABLE_CHANNEL MM4STRY121 + DISABLE_CHANNEL MM4STRY122 + DISABLE_CHANNEL MM4STRY123 + DISABLE_CHANNEL MM4STRY124 + DISABLE_CHANNEL MM4STRY125 + DISABLE_CHANNEL MM4STRY126 + DISABLE_CHANNEL MM4STRY127 + DISABLE_CHANNEL MM4STRY128 + DISABLE_CHANNEL MM4STRY59 + DISABLE_CHANNEL MM4STRY60 + DISABLE_CHANNEL MM4STRY61 + DISABLE_CHANNEL MM4STRY62 + DISABLE_CHANNEL MM4STRY63 + DISABLE_CHANNEL MM4STRY64 + DISABLE_CHANNEL MM4STRY65 + DISABLE_CHANNEL MM4STRY66 + DISABLE_CHANNEL MM4STRY67 + + SI_X_E_RAW_THRESHOLD 8270 + SI_Y_E_RAW_THRESHOLD 8120 + CSI_E_RAW_THRESHOLD 8250 + CSI_SIZE 40 + TAKE_T_Y + TAKE_E_Y diff --git a/Projects/e748/e748.detector b/Projects/e748/e748.detector old mode 100755 new mode 100644 index b1a7abf2a..302a7fe4f --- a/Projects/e748/e748.detector +++ b/Projects/e748/e748.detector @@ -1,102 +1,123 @@ -%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%% Target - THICKNESS= 3.2 micrometer - ANGLE= 20 deg - RADIUS= 24 mm + THICKNESS= 23.5 micrometer + ANGLE= 0 deg + RADIUS= 25 mm MATERIAL= CD2 X= 0 mm Y= 0 mm Z= 0 mm -%%%%%%% Telescope 1 = mechanics2.pdf no1 with y<>z %%%%%%% -M2Telescope - X1_Y1= 13.38 102.64 146.39 mm - X1_Y128= 25.14 10.62 175.69 mm - X128_Y1= 103.73 102.64 110.42 mm - X128_Y128= 115.54 10.70 139.68 mm - SI= 1 - SILI= 0 - CSI= 1 - VIS= all - -%%%%%%% Telescope 2 = mechanics2.pdf no2 with y<>z %%%%%%% -M2Telescope - X1_Y1= -114.11 10.23 138.88 mm - X1_Y128= -23.89 10.34 175.22 mm - X128_Y1= -102.56 102.33 109.73 mm - X128_Y128= -12.33 102.47 146.06 mm - SI= 1 - SILI= 0 - CSI= 1 - VIS= all - -%%%%%%% Telescope 3 = mechanics2.pdf no3 with y<>z & -x %%%%%%% -M2Telescope - X1_Y1= -12.42 -103.75 146.62 mm - X1_Y128= -24.17 -11.63 175.45 mm - X128_Y1= -102.70 -103.88 110.29 mm - X128_Y128= -114.44 -11.78 139.11 mm - SI= 1 - SILI= 0 - CSI= 1 - VIS= all - -%%%%%%% Telescope 4 = mechanics2.pdf no4 with y<>z %%%%%%% -M2Telescope - X1_Y1= 115.22 -11.58 139.29 mm - X1_Y128= 24.87 -11.54 175.28 mm - X128_Y1= 103.79 -103.89 110.54 mm - X128_Y128= 13.44 -103.84 146.53 mm - SI= 1 - SILI= 0 - CSI= 1 - VIS= all - -%%%%%%% Telescope 5 = mechanics2.pdf no7 with y<>z & -x %%%%%%% -M2Telescope - X1_Y1= 173.26 -2.56 -65.31 mm - X1_Y128= 116.26 -3.01 -144.1 mm - X128_Y1= 149.29 90.19 -48.48 mm - X128_Y128= 92.28 89.75 -127.29 mm - SI= 1 - SILI= 1 - CSI= 0 - VIS= all - -%%%%%%% Telescope 6 = mechanics2.pdf no5 with y<>z %%%%%%% -M2Telescope - X1_Y1= -139.15 108.71 -35.67 mm - X128_Y1= -130.34 108.76 61.22 mm - X1_Y128= -181.05 20.86 -31.71 mm - X128_Y128= -172.23 20.92 65.41 mm - SI= 1 - SILI= 0 - CSI= 1 - VIS= all - -%%%%%%% Telescope 7 = mechanics2.pdf no6 with y<>z & -x %%%%%%% -M2Telescope - X1_Y1= -174.31 1.39 65.07 mm - X128_Y1= -145.33 -91.15 62.71 mm - X1_Y128= -182.91 1.17 -32.05 mm - X128_Y128= -153.93 -91.63 -34.41 mm - SI= 1 - SILI= 0 - CSI= 1 - VIS= all - -%%%%%%% Telescope 8 = mechanics2.pdf no8 with y<>z & -x %%%%%%% -M2Telescope - X1_Y1= 80.72 -109.73 -118.89 mm - X128_Y1= 138.0 -109.34 -40.61 mm - X1_Y128= 114.34 -21.77 -143.95 mm - X128_Y128= 171.66 -21.34 -65.46 mm - SI= 1 - SILI= 1 - CSI= 0 - VIS= all +%%%%%%%%%%%%%%%%%%%%% +% T1 +M2Telescope + X128_Y128= -12.2 104.3 146.4 mm + X128_Y1= -102.5 104.4 110.3 mm + X1_Y1= -114.3 12.4 139.4 mm + X1_Y128= -24. 12.2 175.6 mm + SI= 1 + SILI= 0 + CSI= 1 + VIS= all + +% T2 +M2Telescope + X128_Y128= -114.5 -10.3 139.3 + X128_Y1= -103.2 -102.7 110.7 + X1_Y1= -12.9 -102.9 146.9 + X1_Y128= -24.3 -10.5 175.5 + SI= 1 + SILI= 0 + CSI= 1 + VIS= all + +% T3 +M2Telescope + X128_Y128= 13.3 -103.4 146.2 + X128_Y1= 103.7 -103.5 110.3 + X1_Y1= 115.2 -11.3 139.0 + X1_Y128= 24.8 -11.1 174.9 + SI= 1 + SILI= 0 + CSI= 1 + VIS= all + +% T4 +M2Telescope + X128_Y128= 115.2 10.9 139.6 + X128_Y1= 103.8 103.2 110.3 + X1_Y1= 13.7 103.5 146.3 + X1_Y128= 25.1 11.2 175.6 + SI= 1 + SILI= 0 + CSI= 1 + VIS= all + +% T5 +M2Telescope + X128_Y128= 170.8 -20.9 -65.4 + X128_Y1= 137.1 -108.6 -40.4 + X1_Y1= 79.8 -109.1 -118.9 + X1_Y128= 113.4 -21.3 -143.9 + SI= 1 + SILI= 1 + CSI= 0 + VIS= all + +% T6 +M2Telescope + X128_Y128= -154.5 -91.7 -34.0 + X128_Y1= -145.8 -91.3 62.8 + X1_Y1= -173.8 1.9 65.0 + X1_Y128= -182.6 1.5 -31.9 + SI= 1 + SILI= 0 + CSI= 1 + VIS= all + + +% T7 +M2Telescope + X128_Y128= -172.6 21.7 65.7 + X128_Y1= -130.3 109.4 61.4 + X1_Y1= -139.3 108.9 -35.2 + X1_Y128= -181.6 21.2 -30.9 + SI= 1 + SILI= 0 + CSI= 1 + VIS= all + + +% T8 +M2Telescope + X128_Y128= 91.4 91.2 -127.4 + X128_Y1= 148.6 91.0 -48.6 + X1_Y1= 171.8 -2.0 -65.8 + X1_Y128= 114.6 -1.8 -144.5 + SI= 1 + SILI= 0 + CSI= 1 + VIS= all + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%Chio -% Pos= -30. -30. 600. mm +CATSDetector + X1_Y1= -35.86 -34.76 -1457 mm + X28_Y1= 35.26 -34.76 -1457 mm + X1_Y28= -35.86 36.36 -1457 mm + X28_Y28= 35.26 36.36 -1457 mm +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +CATSDetector + X1_Y1= 34.86 -35.36 -949 mm + X28_Y1= -36.26 -35.36 -949 mm + X1_Y28= 34.66 35.76 -949 mm + X28_Y28= -36.26 35.76 -949 mm +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Chio_dig + Pos= -30. -30. 600. mm + +Chio_an + Pos= -30. -30. 600. mm + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %ScintillatorPlastic @@ -114,14 +135,11 @@ M2Telescope Scintillator= BC400 LeadThickness= 0 mm -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%EXL -% !!! Position values are for test only %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EXL POS= -20 30 -20 cm %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - +ModularLeaf + DefaultValue= -1000 + Leafs= T_CATS1_CAV T_CATS1_2 T_MUVI_CATS1 T_PL_CATS2 EXL_HF T_PL_CHIO T_PL_CATS1 diff --git a/Projects/e748/offline/GUser.cxx b/Projects/e748/offline/GUser.cxx index 0b78de4b1..d6859cdfe 100644 --- a/Projects/e748/offline/GUser.cxx +++ b/Projects/e748/offline/GUser.cxx @@ -31,8 +31,8 @@ using namespace std; ClassImp (GUser); GUser::GUser (GDevice* DevIn, GDevice* DevOut):GAcq(DevIn,DevOut){ - NPOptionManager::getInstance()->Destroy(); - NPOptionManager* myOptionManager = NPOptionManager::getInstance("-D ../e748.detector -GH -C calibration.txt "); +NPOptionManager::getInstance()->Destroy(); + NPOptionManager* myOptionManager = NPOptionManager::getInstance("-D ../e748.detector -C calibration.txt "); // Constructor/initialisator of Acquisition object // @@ -60,11 +60,11 @@ GUser::GUser (GDevice* DevIn, GDevice* DevOut):GAcq(DevIn,DevOut){ m_G2RDetectorManager->AddDetector(det[i]); } - // Set the Raw Data poiinter + // Set the Raw Data pointer m_G2RDetectorManager->SetRawDataPointer(m_NPDetectorManager); // Register spectra to GRU - vector < map < string, TH1* > > mySpectra = m_NPDetectorManager->GetSpectra(); +/* vector < map < string, TH1* > > mySpectra = m_NPDetectorManager->GetSpectra(); for (unsigned int i = 0; i < mySpectra.size(); ++i) { // loop on mySpectra map<string, TH1*>::iterator it; for (it = mySpectra[i].begin(); it != mySpectra[i].end(); ++it) { // loop on map @@ -72,7 +72,7 @@ GUser::GUser (GDevice* DevIn, GDevice* DevOut):GAcq(DevIn,DevOut){ GetSpectra()->AddSpectrum(it->second, family.c_str()); } } - +*/ // if(myOptionManager->GetOnline()){ // Request Detector manager to give the Spectra to the server // m_NPDetectorManager->SetSpectraServer(); @@ -92,40 +92,54 @@ GUser::~GUser() { //______________________________________________________________ void GUser::InitUser(){ - // Initialisation for global user treatement - // In this method , we can make histograms (prevously declared in GUser.h) - // Ex : in GUser.h we have declared TH1I *fMyHisto ; - // in this methode we make it fHisto = new TH1I ("MyHisto","MyHisto",1024,0,1024); - // we can include it in database GetSpectra()->AddSpectrum(fMyHisto,"MyFamily"); + m_G2RDetectorManager->Init(GetEvent()->GetDataParameters()); } //______________________________________________________________ void GUser::InitUserRun(){ // Initialisation for user treatemeant for each run // For specific user treatement - m_G2RDetectorManager->Init(GetEvent()->GetDataParameters()); -} + } //______________________________________________________________ void GUser::User(){ static unsigned int count = 0; count++; + m_NPShiftedTree->Fill(); // Clear Data from previous event m_G2RDetectorManager->Clear(); // Loop on new Data + // AGAVA + m_AGAVA_LTS = 0; + UShort_t AGAVA_U = 0; + UShort_t AGAVA_M = 0; + UShort_t AGAVA_L = 0; + int size = GetEventArrayLabelValueSize()/2; for (Int_t i = 0; i < size; i++) { - if (m_G2RDetectorManager->Is(GetEventArrayLabelValue_Label(i),GetEventArrayLabelValue_Value(i))) { - cout << GetEventArrayLabelValue_Label(i) << " " << GetEventArrayLabelValue_Value(i) << endl; + UShort_t Data = GetEventArrayLabelValue_Value(i); + UShort_t Label = GetEventArrayLabelValue_Label(i); + if (m_G2RDetectorManager->Is(Label, Data)) { + cout << Label << " " << Data << endl; m_G2RDetectorManager->Treat(); } + + if (Label==9003) AGAVA_U = Data; + if (Label==9004) AGAVA_M = Data; + if (Label==9005) AGAVA_L = Data; } - + m_AGAVA_LTS = ((ULong64_t) AGAVA_U << 32); + m_AGAVA_LTS += ((ULong64_t) AGAVA_M << 16); + m_AGAVA_LTS += ((ULong64_t) AGAVA_L); + //cout << AGAVA_U << "\t" << AGAVA_M << "\t" << AGAVA_L << "\t" << m_AGAVA_LTS << endl; + // Do nptool analysis - m_NPDetectorManager->BuildPhysicalEvent(); + //m_NPDetectorManager->BuildPhysicalEvent(); // if(count%1000==0) // m_NPDetectorManager->CheckSpectraServer(); + + //cout << "GATCONF:" << m_G2RDetectorManager->GetModularLabelValue("GATCONF") << endl; // Fill the nptool tree //m_NPTree->Fill(); } @@ -134,11 +148,13 @@ count++; //______________________________________________________________ void GUser::EndUserRun(){ + // end of run , executed a end of each run #if __cplusplus > 199711L m_NPDetectorManager->StopThread(); #endif + m_NPShiftedTree->Write(); } //______________________________________________________________ @@ -147,12 +163,21 @@ void GUser::EndUser(){ if(NPOptionManager::getInstance()->GetGenerateHistoOption()) m_NPDetectorManager->WriteSpectra(); + // Write the Physics tree RootOutput::Destroy(); - } //_______________________________________________________________ void GUser::InitTTreeUser(){ m_G2RDetectorManager->InitBranch(fTheTree); + +// gDirectory->cd(fTheTree->GetDirectory()->GetPath()); + m_NPShiftedTree = new TTree("ShiftedTree", "ShiftedTree"); + m_NPShiftedTree->SetDirectory(0); + m_NPShiftedTree->SetDirectory(fTheTree->GetDirectory()); + m_G2RDetectorManager->InitBranch(m_NPShiftedTree); + + // AGAVA + GetTree()->Branch("AGAVA_LTS", &m_AGAVA_LTS, "AGAVA_LTS/l"); } diff --git a/Projects/e748/offline/GUser.h b/Projects/e748/offline/GUser.h index f00a6fa6c..adddff2a4 100644 --- a/Projects/e748/offline/GUser.h +++ b/Projects/e748/offline/GUser.h @@ -57,11 +57,13 @@ class GUser : public GAcq{ #ifndef __MAKECINT__ private: // NPTool NPL::DetectorManager* m_NPDetectorManager; - TTree* m_NPTree; + TTree* m_NPShiftedTree; private: // Ganil2Root G2R::DetectorManager* m_G2RDetectorManager; #endif + private: // AGAVA + ULong64_t m_AGAVA_LTS; }; #endif diff --git a/Projects/e748/offline/Makefile b/Projects/e748/offline/Makefile index 51332d69b..55a8799da 100644 --- a/Projects/e748/offline/Makefile +++ b/Projects/e748/offline/Makefile @@ -1,46 +1,50 @@ - # This Makefile shows nicely how to compile and link applications - CLASSNAME := GUser - GUSERDIR := ./ - G2RINC := $(GANIL2ROOT)/include/ - G2RLIB := $(GANIL2ROOT)/lib/ - LIBDIR := $(GRUDIR)/lib/ - VIGRUDIR := $(GRUDIR)/vigru/ - GTDIR := $(GRUDIR)/GTape/ - GGRUDIR := $(GRUDIR)/GGRU/ - GSOAPDIR := $(GRUDIR)/gsoap/ - MFM_DIR := $(GRUDIR)/MFMlib/ - GRUFLAGS := -I$(GRUDIR)/include/ -I$(LIBDIR) -I$(VIGRUDIR) -I$(GTDIR) -I$(GGRUDIR) -I$(GSOAPDIR) -I$(MFM_DIR) -I$(G2RINC) -I$(NPTOOL)/NPLib/include/ - INCLIST := General.h GAcq.h GDevice.h - # Extensions des fichiers - ObjSuf = o - SrcSuf = cxx - ExeSuf = - DllSuf = so - OutPutOpt = -o - # Compilateur et options - CXX = g++ - CXXFLAGS = -O -Wall -fPIC - LD = g++ - LDFLAGS = -O - SOFLAGS = -shared - # Options de ROOT - ROOTCFLAGS := $(shell root-config --cflags) -I$(ROOTSYS)/xmlparser/inc -I$(ROOTSYS)/io/xmlparser/inc - ROOTLIBS := $(shell root-config --libs) -lHtml -lSpectrum - ROOTGLIBS := $(shell root-config --glibs) - CXXFLAGS += $(ROOTCFLAGS) $(GRUFLAGS) - LIBS = $(ROOTLIBS) $(SYSLIBS) - GLIBS = $(ROOTGLIBS) $(SYSLIBS) - #------------------------------------------------------------------------------ - SHARELIB = $(CLASSNAME).so - all: $(SHARELIB) - #------------------------------------------------------------------------------ +# This Makefile shows nicely how to compile and link applications +CLASSNAME := GUser +GUSERDIR := ./ +G2RINC := $(GANIL2ROOT)/include/ +G2RLIB := $(GANIL2ROOT)/lib/ +LIBDIR := $(GRUDIR)/lib/ +VIGRUDIR := $(GRUDIR)/vigru/ +GTDIR := $(GRUDIR)/GTape/ +GGRUDIR := $(GRUDIR)/GGRU/ +GSOAPDIR := $(GRUDIR)/gsoap/ +MFM_DIR := $(GRUDIR)/MFMlib/ +GRUFLAGS := -I$(GRUDIR)/include/ -I$(LIBDIR) -I$(VIGRUDIR) -I$(GTDIR) -I$(GGRUDIR) -I$(GSOAPDIR) -I$(MFM_DIR) -I$(G2RINC) -I$(NPTOOL)/NPLib/include/ +INCLIST := General.h GAcq.h GDevice.h +# Extensions des fichiers +ObjSuf = o +SrcSuf = cxx +ExeSuf = +DllSuf = so +OutPutOpt = -o +# Compilateur et options +CXX = g++ +CXXFLAGS = -O -Wall -fPIC +LD = g++ +LDFLAGS = -O -L$(LIBDIR) -lGRU -L./ -lGUser -L$(GANIL2ROOT)/lib -lG2RCore -L$(NPTOOL)/NPLib/lib -lNPCore +SOFLAGS = -shared +# Options de ROOT +ROOTCFLAGS := $(shell root-config --cflags) -I$(ROOTSYS)/xmlparser/inc -I$(ROOTSYS)/io/xmlparser/inc +ROOTLIBS := $(shell root-config --libs) -lHtml -lSpectrum +ROOTGLIBS := $(shell root-config --glibs) +CXXFLAGS += $(ROOTCFLAGS) $(GRUFLAGS) +LIBS = $(ROOTLIBS) $(SYSLIBS) +GLIBS = $(ROOTGLIBS) $(SYSLIBS) +#------------------------------------------------------------------------------ +SHARELIB = lib$(CLASSNAME).so +all: $(SHARELIB) Offline Offline_check libGUser.so +#------------------------------------------------------------------------------ - $(CLASSNAME).so:$(CLASSNAME)Dict.o $(CLASSNAME).o +lib$(CLASSNAME).so: $(CLASSNAME)Dict.o $(CLASSNAME).o $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ - $(CLASSNAME)Dict.cxx: $(CLASSNAME).h +$(CLASSNAME)Dict.cxx: $(CLASSNAME).h @echo "Generating dictionary $@..." rootcint -f $@ -c -p $(GRUFLAGS) $^ $(CLASSNAME)LinkDef.h - +Offline: Offline.cxx libGUser.so + $(CXX) $(CXXFLAGS) $(LDFLAGS) Offline.cxx -o Offline +Offline_check: Offline_check.cxx libGUser.so + $(CXX) $(CXXFLAGS) $(LDFLAGS) Offline_check.cxx -o Offline_check + clean: @rm -f core *~ *.o *Dict* diff --git a/Projects/e748/offline/Offline.cxx b/Projects/e748/offline/Offline.cxx index 5d6930091..d2675f005 100644 --- a/Projects/e748/offline/Offline.cxx +++ b/Projects/e748/offline/Offline.cxx @@ -1,26 +1,61 @@ -void Offline(){ - gROOT->Reset(); - char command[100]; - gROOT->ProcessLine(command); - gSystem->Load("GUser.so"); //load and compile GUser class - GTape *file = new GTape("/data/muviX/must2/acquisition/run/run_0011.dat.16-06-17_01h18m04s"); - //GTape *file = new GTape("/data/muviX/must2/acquisition/run/run_0008.dat.15-06-17_19h23m54s"); - - file->Open(); - GUser * a= new GUser(file); // creat user treatement environement - //GNetServerRoot *serv = new GNetServerRoot(9094, a); - a->EventInit("exl"); // even initialisation - //a->SetSpectraMode(1); // Declare all raw parameters as histograms - a->SetSpectraMode(0); - a->SetTTreeMode(3, "./run11.root"); - a->InitUser(); - //serv->StartServer(); - file->Rewind(); - a->DoRun(); // a->DoRun(2000); do treaments on 2000 first events ( 0 = all); - a->EndUser(); // must be explicitly called , if it needs - a->SpeSave("histo.root"); // save all declared histogram - delete (a); // finish - gROOT->ProcessLine(".q"); +/***************************************************************************** + * Original Author: V. Girard-Alcindor * + * contact address: girardalcindor@ganil.fr * + * * + * Creation Date : June 2017 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This programm convert a GANIL run into a root file readable by NpTool * + *---------------------------------------------------------------------------* + * Comment: * + * If you want to convert multiple run you should use the run_analysis.sh * + * script you will find in this folder * + * * + *****************************************************************************/ + +#include <iostream> +#include "GTape.h" +#include "GUser.h" +#include "General.h" +using namespace std; + +int main(int argc, char * argv[]){ + + std::string run, output_run; + if(argc!=1){ + run=argv[1]; // Run name + output_run=argv[2]; // Output run.root + } + + cout << " * Looking for Run " << run << endl ; + + GTape *file = new GTape(run.c_str()); + /// analyse + /// Open + file->Open(); + GUser * a= new GUser(file); // creat user treatement environement + //GNetServerRoot *serv = new GNetServerRoot(9094, a); + //a->EventInit("must2"); // even initialisation + a->EventInit("e748"); // even initialisation + /// set tree mode and name + //a->SetSpectraMode(1); // Declare all raw parameters as histograms + a->SetSpectraMode(0); + + a->SetTTreeMode((TTreeMode)3, output_run.c_str()); + /// work the data + a->InitUser(); + //serv->StartServer(); + file->Rewind(); + a->DoRun(); + //a->DoRun(2000); //do treaments on 2000 first events ( 0 = all); + /// wrap-up and save spectra with a specific name + a->EndUser(); // must be explicitly called , if it needs + /* a->SpeSave(histName); // save all declared histogram */ + // delete Guser object + delete (a); // finish + + return 0; } diff --git a/Projects/e748/online/GUser.cxx b/Projects/e748/online/GUser.cxx index f7e1166b4..a5d542958 100644 --- a/Projects/e748/online/GUser.cxx +++ b/Projects/e748/online/GUser.cxx @@ -79,7 +79,6 @@ GUser::GUser (GDevice* DevIn, GDevice* DevOut):GAcq(DevIn,DevOut){ // } - } //_____________________________________________________________________________ @@ -92,19 +91,30 @@ GUser::~GUser() { //______________________________________________________________ void GUser::InitUser(){ - // Initialisation for global user treatement - // In this method , we can make histograms (prevously declared in GUser.h) - // Ex : in GUser.h we have declared TH1I *fMyHisto ; - // in this methode we make it fHisto = new TH1I ("MyHisto","MyHisto",1024,0,1024); - // we can include it in database GetSpectra()->AddSpectrum(fMyHisto,"MyFamily"); + m_G2RDetectorManager->Init(GetEvent()->GetDataParameters()); + // Add the modular label spectra + map<string, TH1S*>::iterator it; + map<string, TH1S*> MLS = m_G2RDetectorManager->GetModularLabelSpectra(); + for (it = MLS.begin(); it != MLS.end(); ++it) { // loop on map + string family = it->first.substr(0, it->first.find_last_of("/", string::npos)); + GetSpectra()->AddSpectrum(it->second, family.c_str()); + } + + h_TPLCATS1_corr = new TH2F("h_TPLCATS1_corr","h_TPLCATS1_corr",512,0,16384,512,0,16384); + h_TPLCATS1_corr->GetXaxis()->SetTitle("Time PL-CATS1 in VXI M2"); + h_TPLCATS1_corr->GetXaxis()->CenterTitle(); + h_TPLCATS1_corr->GetYaxis()->SetTitle("Time PL-CATS1 in VXI Chio"); + h_TPLCATS1_corr->GetYaxis()->CenterTitle(); + GetSpectra()->AddSpectrum(h_TPLCATS1_corr ,"ModularLabel"); + + } //______________________________________________________________ void GUser::InitUserRun(){ // Initialisation for user treatemeant for each run // For specific user treatement - m_G2RDetectorManager->Init(GetEvent()->GetDataParameters()); -} + } //______________________________________________________________ void GUser::User(){ @@ -125,6 +135,10 @@ count++; // if(count%1000==0) // m_NPDetectorManager->CheckSpectraServer(); + + h_TPLCATS1_corr->Fill(m_G2RDetectorManager->GetModularLabelValue("T_PL_CATS1"), + m_G2RDetectorManager->GetModularLabelValue("T_PLchCATS1")); + // Fill the nptool tree //m_NPTree->Fill(); } diff --git a/Projects/e748/online/GUser.h b/Projects/e748/online/GUser.h index f00a6fa6c..e9ac4d9db 100644 --- a/Projects/e748/online/GUser.h +++ b/Projects/e748/online/GUser.h @@ -53,6 +53,8 @@ class GUser : public GAcq{ virtual void EndUser(); virtual void InitTTreeUser(); ClassDef (GUser ,1); // User Treatment of Data + + TH2F* h_TPLCATS1_corr; #ifndef __MAKECINT__ private: // NPTool diff --git a/Projects/e748/online/Online.cxx b/Projects/e748/online/Online.cxx index cce6412d7..32f9eb79a 100644 --- a/Projects/e748/online/Online.cxx +++ b/Projects/e748/online/Online.cxx @@ -1,28 +1,27 @@ -void Online(){ +void Online(){ // specify good include dir! - gROOT->Reset(); + // gROOT->Reset(); - char command[100]; - gROOT->ProcessLine(command); - gSystem->Load("GUser.so"); //load and compile GUser class +// char command[100]; +// gROOT->ProcessLine(command); + gSystem->Load("/home/e748/analysis/ganil2root/lib/libG2RCore.so"); + gSystem->Load("./GUser.so"); //load GUser class - GNetClientNarval *net = new GNetClientNarval("ganp207"); // - net->SetPort(10202); + GNetClientNarval *net = new GNetClientNarval("ganp616"); + net->SetPort(10221); net->SetBufferSize(65536); - GUser * a= new GUser(net); // creat user treatement environement + GUser* a= new GUser(net); // creat user treatement environement GNetServerRoot *serv = new GNetServerRoot(9094, a); - a->EventInit("must2"); // even initialisation - //a->SetSpectraMode(1); // Declare all raw parameters as histograms + a->EventInit("e748"); // even initialisation + //a->SetSpectraMode(2); // Declare all raw parameters as histograms a->SetSpectraMode(0); a->InitUser(); serv->StartServer(); - a->DoRun(); // a->DoRun(2000); do treaments on 2000 first events ( 0 = all); - net->Close(); + a->DoRun(); // a->DoRun(2002); do treaments on 2000 first events ( 0 = all); + net->Close() a->EndUser(); // must be explicitly called , if it needs - a->SpeSave("histo.root"); // save all declared histogram + //a->SpeSave("histo.root"); // save all declared histogram delete (a); // finish gROOT->ProcessLine(".q"); } - - -- GitLab