diff --git a/NPLib/Detectors/MDM/TMDMData.cxx b/NPLib/Detectors/MDM/TMDMData.cxx index 6a5535c0ebcdbcbd2b4019c263d133b072b6f937..b43984f745806780e502624907ddbdb90065eb0b 100644 --- a/NPLib/Detectors/MDM/TMDMData.cxx +++ b/NPLib/Detectors/MDM/TMDMData.cxx @@ -44,12 +44,14 @@ TMDMData::~TMDMData() { ////////////////////////////////////////////////////////////////////// void TMDMData::Clear() { - // Energy - fMDM_X_DetectorNbr.clear(); + fMDM_DetectorNbr.clear(); + // X fMDM_Xpos.clear(); - // Time - fMDM_Y_DetectorNbr.clear(); + // Y fMDM_Ypos.clear(); + // ID + fMDM_Particle_Mass.clear(); + fMDM_Particle_Charge.clear(); } @@ -60,20 +62,14 @@ void TMDMData::Dump() const { cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TMDMData::Dump()] XXXXXXXXXXXXXXXXX" << endl; // X - position - size_t mysize = fMDM_X_DetectorNbr.size(); - cout << "MDM_X_Mult: " << mysize << endl; + size_t mysize = fMDM_DetectorNbr.size(); + cout << "MDM_Mult: " << mysize << endl; for (size_t i = 0 ; i < mysize ; i++){ - cout << "DetNbr: " << fMDM_X_DetectorNbr[i] - << " X position: " << fMDM_Xpos[i]; - } - - // Y - position - mysize = fMDM_Y_DetectorNbr.size(); - cout << "MDM_Y_Mult: " << mysize << endl; - - for (size_t i = 0 ; i < mysize ; i++){ - cout << "DetNbr: " << fMDM_Y_DetectorNbr[i] - << " Y position: " << fMDM_Ypos[i]; - } + cout << "DetNbr: " << fMDM_DetectorNbr[i] + << ", X position: " << fMDM_Xpos[i] + << ", Y position: " << fMDM_Ypos[i] + << ", Particle Mass: " << fMDM_Particle_Mass[i] + << ", Particle Charge: " << fMDM_Particle_Charge[i] << endl; + } } diff --git a/NPLib/Detectors/MDM/TMDMData.h b/NPLib/Detectors/MDM/TMDMData.h index 3facd11ce0894a9d915a6705cae7a9aea681f19e..a3669fc829a9df1a853bb60c9f0ea5a0b37c14ee 100644 --- a/NPLib/Detectors/MDM/TMDMData.h +++ b/NPLib/Detectors/MDM/TMDMData.h @@ -33,15 +33,20 @@ class TMDMData : public TObject { ////////////////////////////////////////////////////////////// // data members are hold into vectors in order // to allow multiplicity treatment - private: + private: + // Detector Number + vector<UShort_t> fMDM_DetectorNbr; + // X - position - vector<UShort_t> fMDM_X_DetectorNbr; vector<Double_t> fMDM_Xpos; // Y - position - vector<UShort_t> fMDM_Y_DetectorNbr; vector<Double_t> fMDM_Ypos; + // Particle ID + vector<UShort_t> fMDM_Particle_Charge; + vector<Double_t> fMDM_Particle_Mass; + ////////////////////////////////////////////////////////////// // Constructor and destructor @@ -65,39 +70,36 @@ class TMDMData : public TObject { // add //! to avoid ROOT creating dictionnary for the methods public: ////////////////////// SETTERS //////////////////////// - // X - position - inline void SetXpos(const UShort_t& DetNbr,const Double_t& x){ - fMDM_X_DetectorNbr.push_back(DetNbr); + // + inline void SetHit(UShort_t DetNbr, Double_t x, Double_t y, UShort_t charge, Double_t mass){ + fMDM_DetectorNbr.push_back(DetNbr); fMDM_Xpos.push_back(x); - };//! - - // Y - position - inline void SetYpos(const UShort_t& DetNbr,const Double_t& y){ - fMDM_Y_DetectorNbr.push_back(DetNbr); fMDM_Ypos.push_back(y); + fMDM_Particle_Mass.push_back(mass); + fMDM_Particle_Charge.push_back(charge); };//! ////////////////////// GETTERS //////////////////////// + inline UShort_t GetMult() const + {return fMDM_DetectorNbr.size();} + inline UShort_t GetDetectorNbr(const unsigned int &i) const + {return fMDM_DetectorNbr[i];}//! // X - position - inline UShort_t GetMultX() const - {return fMDM_X_DetectorNbr.size();} - inline UShort_t GetX_DetectorNbr(const unsigned int &i) const - {return fMDM_X_DetectorNbr[i];}//! inline Double_t Get_Xpos(const unsigned int &i) const {return fMDM_Xpos[i];}//! - // Y - position - inline UShort_t GetMultY() const - {return fMDM_Y_DetectorNbr.size();} - inline UShort_t GetY_DetectorNbr(const unsigned int &i) const - {return fMDM_Y_DetectorNbr[i];}//! inline Double_t Get_Ypos(const unsigned int &i) const {return fMDM_Ypos[i];}//! - + // Particle ID + inline Double_t GetParticleMass(const unsigned int& i) const + {return fMDM_Particle_Mass[i];}//! + inline UShort_t GetParticleCharge(const unsigned int& i) const + {return fMDM_Particle_Charge[i];}//! + ////////////////////////////////////////////////////////////// // Required for ROOT dictionnary - ClassDef(TMDMData,1) // MDMData structure + ClassDef(TMDMData,2) // MDMData structure }; #endif diff --git a/NPLib/Detectors/MDM/TMDMPhysics.cxx b/NPLib/Detectors/MDM/TMDMPhysics.cxx index e3545bf6fac132e12358a638e11cc0156cb07873..64a72fccbbfdf6adc16b903367e92d967fda3b63 100644 --- a/NPLib/Detectors/MDM/TMDMPhysics.cxx +++ b/NPLib/Detectors/MDM/TMDMPhysics.cxx @@ -127,13 +127,12 @@ void TMDMPhysics::BuildPhysicalEvent() { PreTreat(); // match x and y - UInt_t mysizeX = m_PreTreatedData->GetMultX(); - UInt_t mysizeY = m_PreTreatedData->GetMultY(); + UInt_t mysize = m_PreTreatedData->GetMult(); UInt_t i0=-1, i1=-1; - for (UShort_t ix = 0; ix < mysizeX ; ix++) { - for (UShort_t iy = 0; iy < mysizeY ; iy++) { - if (m_PreTreatedData->GetX_DetectorNbr(ix) == m_PreTreatedData->GetY_DetectorNbr(iy)) { - int detno = m_PreTreatedData->GetX_DetectorNbr(ix); + for (UShort_t ix = 0; ix < mysize ; ix++) { + for (UShort_t iy = 0; iy < mysize ; iy++) { + if (m_PreTreatedData->GetDetectorNbr(ix) == m_PreTreatedData->GetDetectorNbr(iy)) { + int detno = m_PreTreatedData->GetDetectorNbr(ix); if(detno >= 0 && detno < 4) { DetectorNumber.push_back(detno); @@ -169,26 +168,17 @@ void TMDMPhysics::PreTreat() { // instantiate CalibrationManager static CalibrationManager* Cal = CalibrationManager::getInstance(); - // X - position - UInt_t mysize = m_EventData->GetMultX(); + UInt_t mysize = m_EventData->GetMult(); for (UShort_t i = 0; i < mysize ; ++i) { - if (m_EventData->Get_Xpos(i) < m_X_Threshold) { - Double_t Xpos = Cal->ApplyCalibration("MDM/XPOS"+NPL::itoa(m_EventData->GetX_DetectorNbr(i)),m_EventData->Get_Xpos(i)); + if (m_EventData->Get_Xpos(i) < m_X_Threshold && m_EventData->Get_Ypos(i) < m_Y_Threshold) { + Double_t Xpos = Cal->ApplyCalibration("MDM/XPOS"+NPL::itoa(m_EventData->GetDetectorNbr(i)),m_EventData->Get_Xpos(i)); + Double_t Ypos = Cal->ApplyCalibration("MDM/YPOS"+NPL::itoa(m_EventData->GetDetectorNbr(i)),m_EventData->Get_Ypos(i)); + Double_t Mass = m_EventData->GetParticleMass(i); + UShort_t Charge = m_EventData->GetParticleCharge(i); if (true) { - m_PreTreatedData->SetXpos(m_EventData->GetX_DetectorNbr(i), Xpos); + m_PreTreatedData->SetHit(m_EventData->GetDetectorNbr(i), Xpos, Ypos, Charge, Mass); } - } - } - - // Y - position - mysize = m_EventData->GetMultY(); - for (UShort_t i = 0; i < mysize ; ++i) { - if (m_EventData->Get_Ypos(i) < m_Y_Threshold) { - Double_t Ypos = Cal->ApplyCalibration("MDM/YPOS"+NPL::itoa(m_EventData->GetY_DetectorNbr(i)),m_EventData->Get_Ypos(i)); - if (true) { - m_PreTreatedData->SetYpos(m_EventData->GetY_DetectorNbr(i), Ypos); - } - } + } } } diff --git a/NPSimulation/Detectors/MDM/MDM.cc b/NPSimulation/Detectors/MDM/MDM.cc index 6bb6ba7f527933013756b288bf70d260670bff60..a6f49def307937c6bc0d36afff47145feb1e8508 100644 --- a/NPSimulation/Detectors/MDM/MDM.cc +++ b/NPSimulation/Detectors/MDM/MDM.cc @@ -153,7 +153,7 @@ void MDM::ReadConfiguration(NPL::InputParser parser){ void MDM::ConstructDetector(G4LogicalVolume* world){ G4double wX = 0; G4double wY = 0; - G4double wZ = 1e-6*m; + G4double wZ = 30*cm; G4ThreeVector Det_pos = G4ThreeVector(wX, wY, wZ) ; new G4PVPlacement(0, Det_pos, BuildSquareDetector(), @@ -186,7 +186,7 @@ void MDM::ReadSensitive(const G4Event* event){ // Read energy, position, momentum double Ekin = Iter.second->Edep; // MeV double Mass = Iter.second->Mass; // MeV/c^2 - double Charge = Iter.second->Charge;// e + unsigned short Charge = Iter.second->Charge;// e const G4ThreeVector& Pos = Iter.second->Pos; // mm const G4ThreeVector& Mom = Iter.second->Mom; // rad @@ -218,8 +218,7 @@ void MDM::ReadSensitive(const G4Event* event){ // Set X, Y positions in TMDMData class for(int i=0; i< 4; ++i) { - m_Event->SetXpos(i, x[i]); - m_Event->SetYpos(i, y[i]); + m_Event->SetHit(i, x[i], y[i], Charge, Mass/amu_c2); } ++indx;