Skip to content

Commit

Permalink
Merge pull request #225 from PADME-Experiment/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
eleonardi committed Feb 19, 2021
2 parents bdc81e5 + f94764d commit 7294321
Show file tree
Hide file tree
Showing 62 changed files with 1,976 additions and 255 deletions.
1 change: 1 addition & 0 deletions PadmeDB/PadmeDAQ_data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ conn_board 1:0:1:2 16 2018-07-01 00:00:00

conn_board 1:0:1:3 16 2018-03-19 00:00:00
conn_board 1:0:1:3 6 2018-07-01 00:00:00
conn_board 1:0:1:3 10 2020-06-12 11:00:00

conn_board 1:0:1:4 6 2018-03-19 00:00:00
conn_board 1:0:1:4 7 2018-07-01 00:00:00
Expand Down
21 changes: 15 additions & 6 deletions PadmeDB/PadmeDAQ_setup.readme
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
PADME uses the MySQL database system to store DAQ related information.
These are the instructions to install and configure this system on a CentOS 7 node.

Make sure you know what are the default passwords for the "root" and "padme" MySQL accounts.
Here they are referred to as <db_root_pw> and <db_padme_pw>.
Make sure you know what are the default passwords for the "root", "padme" and "padmeRUN"
MySQL accounts.
Here they are referred to as <db_root_pw>, <db_padme_pw> and <db_padmeRUN_pw>.
N.B. user "padme" has ALL privileges to the PadmeDAQ database while user "padmeRUN"
has only SELECT privileges.

1) Login as root to install and configure the open source version of MySQL, MariaDB:

Expand Down Expand Up @@ -47,13 +50,19 @@ mysql> CREATE DATABASE PadmeDAQ;
mysql> CREATE USER 'padme'@'localhost' IDENTIFIED BY '<db_padme_pw>';
mysql> CREATE USER 'padme'@'127.0.0.1' IDENTIFIED BY '<db_padme_pw>';
mysql> CREATE USER 'padme'@'%.lnf.infn.it' IDENTIFIED BY '<db_padme_pw>';
mysql> CREATE USER 'padme'@'192.168.60.%' IDENTIFIED BY '<db_padme_pw>';
mysql> CREATE USER 'padme'@'192.168.62.%' IDENTIFIED BY '<db_padme_pw>';
mysql> CREATE USER 'padme'@'192.168.%' IDENTIFIED BY '<db_padme_pw>';
mysql> GRANT ALL ON PadmeDAQ.* TO 'padme'@'localhost';
mysql> GRANT ALL ON PadmeDAQ.* TO 'padme'@'127.0.0.1';
mysql> GRANT ALL ON PadmeDAQ.* TO 'padme'@'%.lnf.infn.it';
mysql> GRANT ALL ON PadmeDAQ.* TO 'padme'@'192.168.60.%';
mysql> GRANT ALL ON PadmeDAQ.* TO 'padme'@'192.168.62.%';
mysql> GRANT ALL ON PadmeDAQ.* TO 'padme'@'192.168.%';
mysql> CREATE USER 'padmeRUN'@'localhost' IDENTIFIED BY '<db_padmeRUN_pw>';
mysql> CREATE USER 'padmeRUN'@'127.0.0.1' IDENTIFIED BY '<db_padmeRUN_pw>';
mysql> CREATE USER 'padmeRUN'@'%.lnf.infn.it' IDENTIFIED BY '<db_padmeRUN_pw>';
mysql> CREATE USER 'padmeRUN'@'192.168.%' IDENTIFIED BY '<db_padmeRUN_pw>';
mysql> GRANT SELECT ON PadmeDAQ.* TO 'padmeRUN'@'localhost';
mysql> GRANT SELECT ON PadmeDAQ.* TO 'padmeRUN'@'127.0.0.1';
mysql> GRANT SELECT ON PadmeDAQ.* TO 'padmeRUN'@'%.lnf.infn.it';
mysql> GRANT SELECT ON PadmeDAQ.* TO 'padmeRUN'@'192.168.%';
mysql> exit

8) Reconnect to MySQL as "padme" user (using <db_padme_pw>) and create the
Expand Down
77 changes: 77 additions & 0 deletions PadmeMC/BeamLine/include/BeamFlagDigi.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// --------------------------------------------------------------
// History:
//
// Created by Mauro Raggi (mauro.raggi@roma1.infn.it) 2019-04-29
//
// --------------------------------------------------------------

#ifndef BeamFlagDigi_h
#define BeamFlagDigi_h 1

#include "G4VDigi.hh"
#include "G4TDigiCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

class BeamFlagDigi : public G4VDigi
{
public:

BeamFlagDigi();
~BeamFlagDigi();
BeamFlagDigi(const BeamFlagDigi&);
const BeamFlagDigi& operator=(const BeamFlagDigi&);
G4int operator==(const BeamFlagDigi&) const;

inline void* operator new(size_t);
inline void operator delete(void*);

void Draw();
void Print();

public:

void SetChannelId(G4int c) { fChannelId = c; }
G4int GetChannelId() { return fChannelId; }

void SetTime(G4double t) { fTime = t; };
G4double GetTime() { return fTime; };

void SetEnergy(G4double e) { fEnergy = e; }
G4double GetEnergy() { return fEnergy; }

private:

G4int fChannelId;
G4double fTime;
G4double fEnergy;

};

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

typedef G4TDigiCollection<BeamFlagDigi> BeamFlagDigiCollection;

extern G4Allocator<BeamFlagDigi> BeamFlagDigiAllocator;

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

inline void* BeamFlagDigi::operator new(size_t)
{
void* aDigi;
aDigi = (void*) BeamFlagDigiAllocator.MallocSingle();
return aDigi;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

inline void BeamFlagDigi::operator delete(void* aDigi)
{
BeamFlagDigiAllocator.FreeSingle((BeamFlagDigi*) aDigi);
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

#endif
106 changes: 106 additions & 0 deletions PadmeMC/BeamLine/include/BeamFlagHit.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#ifndef BeamFlagHit_h
#define BeamFlagHit_h 1

#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

class BeamFlagHit : public G4VHit
{

public:

BeamFlagHit();
~BeamFlagHit();
BeamFlagHit(const BeamFlagHit&);
const BeamFlagHit& operator=(const BeamFlagHit&);
G4int operator==(const BeamFlagHit&) const;

inline void* operator new(size_t);
inline void operator delete(void*);

void Draw();
void Print();

public:

void SetChannelId(G4int c) { fChannelId = c; }
G4int GetChannelId() { return fChannelId; }

void SetTime(G4double t) { fTime = t; };
G4double GetTime() { return fTime; };

void SetEnergy(G4double e) { fEnergy = e; }
G4double GetEnergy() { return fEnergy; }

void SetPosition(G4ThreeVector p) { fPosition = p; }
G4ThreeVector GetPosition() { return fPosition; }
G4double GetPosX() { return fPosition.x(); };
G4double GetPosY() { return fPosition.y(); };
G4double GetPosZ() { return fPosition.z(); };

//M. Raggi 2/04/2019 added track energy
void SetTrackEnergy(G4double etr) { fTrackEnergy = etr; }
G4double GetTrackEnergy() { return fTrackEnergy; }

//M. Raggi 2/04/2019 added track energy
G4double GetPX() { return fMomentumDirection.x(); };
G4double GetPY() { return fMomentumDirection.y(); };
G4double GetPZ() { return fMomentumDirection.z(); };
void SetPDir(G4ThreeVector pdir) {fMomentumDirection=pdir;}

void SetLocalPosition(G4ThreeVector p) { fLocalPosition = p; }
G4ThreeVector GetLocalPosition() { return fLocalPosition; }
G4double GetLocalPosX() { return fLocalPosition.x(); };
G4double GetLocalPosY() { return fLocalPosition.y(); };
G4double GetLocalPosZ() { return fLocalPosition.z(); };

// Kept for backward compatibility: will be removed
void SetEdep(G4double e) { fEnergy = e; }
G4double GetEdep() { return fEnergy; }
void SetPos(G4ThreeVector xyz) { fPosition = xyz; };
G4ThreeVector GetPos() { return fPosition; };
G4double GetX() { return fPosition.x(); };
G4double GetY() { return fPosition.y(); };
G4double GetZ() { return fPosition.z(); };

private:

G4int fChannelId;
G4double fTime;
G4double fEnergy;
G4double fTrackEnergy; //M. Raggi 2/04/2019 added track energy
G4ThreeVector fPosition;
G4ThreeVector fLocalPosition;
G4ThreeVector fMomentumDirection; //M. Raggi 5/04/2019 added track energy

};

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

typedef G4THitsCollection<BeamFlagHit> BeamFlagHitsCollection;

extern G4Allocator<BeamFlagHit> BeamFlagHitAllocator;

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

inline void* BeamFlagHit::operator new(size_t)
{
void *aHit;
aHit = (void *) BeamFlagHitAllocator.MallocSingle();
return aHit;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

inline void BeamFlagHit::operator delete(void *aHit)
{
BeamFlagHitAllocator.FreeSingle((BeamFlagHit*) aHit);
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

#endif
25 changes: 25 additions & 0 deletions PadmeMC/BeamLine/include/BeamFlagSD.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef BeamFlagSD_h
#define BeamFlagSD_h 1

#include "G4VSensitiveDetector.hh"

#include "BeamFlagHit.hh"

class G4Step;
class G4HCofThisEvent;

class BeamFlagSD : public G4VSensitiveDetector
{
public:
BeamFlagSD(G4String);
~BeamFlagSD();

void Initialize(G4HCofThisEvent*);
G4bool ProcessHits(G4Step*, G4TouchableHistory*);
void EndOfEvent(G4HCofThisEvent*);

private:
BeamFlagHitsCollection* fBeamFlagCollection;
};

#endif
11 changes: 11 additions & 0 deletions PadmeMC/BeamLine/include/BeamLineGeometry.hh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ public:
void DisableBeWindow() { fBeWindowEnable = false; }
G4bool BeWindowIsEnabled() { return fBeWindowEnable; }

void EnableBeamFlag() { fBeamFlagEnable = true; }
void DisableBeamFlag() { fBeamFlagEnable = false; }
G4bool BeamFlagIsEnabled() { return fBeamFlagEnable; } // M. Raggi 28/08/2019

G4String fBeWSensitiveDetectorName;
G4String fBeamFlag1SensitiveDetectorName;
G4String fBeamFlag2SensitiveDetectorName;
G4String fBeamFlag3SensitiveDetectorName;

// Magnetic field inside DHSTB002

Expand Down Expand Up @@ -167,12 +174,16 @@ public:

// Get name of BeW sensitive detector
G4String GetBeWSensitiveDetectorName() { return fBeWSensitiveDetectorName; }
G4String GetBeamFlag1SensitiveDetectorName() { return fBeamFlag1SensitiveDetectorName; }
G4String GetBeamFlag2SensitiveDetectorName() { return fBeamFlag2SensitiveDetectorName; }
G4String GetBeamFlag3SensitiveDetectorName() { return fBeamFlag3SensitiveDetectorName; }

private:

// Berillium thin window and stainless still flange

G4bool fBeWindowEnable;
G4bool fBeamFlagEnable;

// Magnetic field
G4double fDHSTB002MagneticFieldY;
Expand Down
1 change: 1 addition & 0 deletions PadmeMC/BeamLine/include/BeamLineMessenger.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private:
G4UIdirectory* fBeamLineDir;

G4UIcmdWithABool* fEnableBeWindowCmd;
G4UIcmdWithABool* fEnableBeamFlagCmd;
G4UIcmdWithADoubleAndUnit* fSetDHSTB002MagneticFieldYCmd;

G4UIcmdWithABool* fEnableQuadrupolesCmd;
Expand Down
2 changes: 2 additions & 0 deletions PadmeMC/BeamLine/include/BeamLineStructure.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ private:
G4LogicalVolume* fMotherVolume;
//G4LogicalVolume* fGlobalLogicalVolume;
G4LogicalVolume* fBeWindowVolume;
G4LogicalVolume* fBeamFlag1Volume;
G4LogicalVolume* fBeamFlag2Volume;

QuadSetup * fMagneticFieldManager;
//G4int fBeamLineExists;
Expand Down
80 changes: 80 additions & 0 deletions PadmeMC/BeamLine/src/BeamFlagDigi.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// --------------------------------------------------------------
// History:
//
// Created by Mauro Raggi (mauro.raggi@roma1.infn.it) 2019-08-29
//
// --------------------------------------------------------------

#include "BeamFlagDigi.hh"

#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"

G4Allocator<BeamFlagDigi> BeamFlagDigiAllocator;

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

BeamFlagDigi::BeamFlagDigi() {}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

BeamFlagDigi::~BeamFlagDigi() {}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

BeamFlagDigi::BeamFlagDigi(const BeamFlagDigi& right)
: G4VDigi()
{
fChannelId = right.fChannelId;
fTime = right.fTime;
fEnergy = right.fEnergy;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

const BeamFlagDigi& BeamFlagDigi::operator=(const BeamFlagDigi& right)
{
fChannelId = right.fChannelId;
fTime = right.fTime;
fEnergy = right.fEnergy;
return *this;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

G4int BeamFlagDigi::operator==(const BeamFlagDigi& right) const
{
return (this==&right) ? 1 : 0;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void BeamFlagDigi::Draw()
{
G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
if(visManager)
{
//G4Circle circle(fPosition);
//circle.SetScreenSize(2.);
//circle.SetFillStyle(G4Circle::filled);
//G4Colour colour(0.,1.,0.);
//G4VisAttributes attribs(colour);
//circle.SetVisAttributes(attribs);
//visManager->Draw(circle);
}
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void BeamFlagDigi::Print()
{
G4cout << "- channel: " << fChannelId
<< " time: " << G4BestUnit(fTime,"Time")
<< " energy: " << G4BestUnit(fEnergy,"Energy")
<< G4endl;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Loading

0 comments on commit 7294321

Please sign in to comment.