Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Riccardo Longo
JZCaPA
Commits
1d088ad6
Commit
1d088ad6
authored
Aug 30, 2021
by
Riccardo Longo
Browse files
Start of 2021 Test Beam implementation. Framework not yet optimized and not yet tested.
parent
cb1acc60
Changes
19
Show whitespace changes
Inline
Side-by-side
Analysis/CMakeLists.txt
View file @
1d088ad6
Analysis/include/Analysis.h
View file @
1d088ad6
...
...
@@ -52,6 +52,8 @@ class Analysis{
Visualizer
*
m_viz
=
0
;
/** Alignment information for the given run */
Alignment
*
m_alignment
;
/** Alignment information for the given run */
Alignment2021
*
m_alignment2021
;
};
#endif
Analysis/include/Containers.h
View file @
1d088ad6
...
...
@@ -47,6 +47,8 @@ class Channel {
bool
is_on
;
/** Operating voltage of the channel*/
int
Vop
;
/** PMT reference code **/
std
::
string
PMTcode
;
/** Raw waveform for a particular event */
std
::
vector
<
float
>
WF
;
/** Pointer to the WF vector */
...
...
@@ -117,5 +119,38 @@ class Alignment {
};
class
Alignment2021
{
public:
/** Run number being analyzed **/
int
runNumber
;
/** Beam type - can be p or e in H2 2021 **/
std
::
string
beam_type
;
/** Beam energy **/
double
beam_energy
;
/** X position of the NIKHEF Table **/
double
x_det_table
;
/** Y position of the NIKHEF Table **/
double
y_det_table
;
/** X position of the Trigger Table **/
double
x_trig_table
;
/** Y position of the Trigger Table **/
double
y_trig_table
;
/** First detector met by the beam **/
std
::
string
Det1
;
/** Second detector met by the beam **/
std
::
string
Det2
;
/** Third detector met by the beam **/
std
::
string
Det3
;
/** Fourth detector met by the beam **/
std
::
string
Det4
;
/** Fifth detector met by the beam **/
std
::
string
Det5
;
/** Sixth detector met by the beam **/
std
::
string
Det6
;
/** GOLIATH magnet status **/
};
#endif
Analysis/include/DataReader2021.h
0 → 100644
View file @
1d088ad6
/** @file DataReader2021
* @brief Function prototypes for DataReader2021
*
* This contains the prototypes and members
* for DataReader2021
*
* @author Yakov Kulinich
* @bug No known bugs.
*/
#ifndef DataReader2021_H
#define DataReader2021_H
#include
<iostream>
#include
<iomanip>
#include
<fstream>
#include
<sstream>
#include
<stdio.h>
#include
<string>
#include
<vector>
#include
"XMLSettingsReader.h"
#include
"Containers.h"
#include
"Detector.h"
#include
"ZDC.h"
#include
"RPD.h"
#include
<TChain.h>
#include
<TSystem.h>
class
TFile
;
class
Analysis
;
class
DataReader2021
{
public:
DataReader2021
(
);
DataReader2021
(
const
unsigned
int
=
0
,
const
unsigned
int
=
0
);
DataReader2021
(
const
unsigned
int
=
0
,
const
unsigned
int
=
0
,
const
std
::
string
&
=
""
);
DataReader2021
(
const
unsigned
int
=
0
,
const
unsigned
int
=
0
,
const
std
::
string
&
=
""
,
const
unsigned
int
=
0
);
virtual
~
DataReader2021
();
void
AddPreAnalysis
(
Analysis
*
);
void
AddDetectorAnalysis
(
Analysis
*
);
void
SelectDetectorForAnalysis
(
bool
_useUEM
,
bool
_usePFRPD
,
bool
_useTRPD
,
bool
_useZDCs
);
void
ReadListOfFiles
(
std
::
string
listname
);
void
LoadAlignmentFile
(
std
::
string
_inFile
=
std
::
getenv
(
"JZCaPA"
)
+
std
::
string
(
"/Utils/Alignment_2018.xml"
));
void
LoadConfigurationFile
(
std
::
string
_inFile
=
std
::
getenv
(
"JZCaPA"
)
+
std
::
string
(
"/Utils/ConfigFile2018.xml"
));
void
LoadTimingFile
(
std
::
string
_inFile
=
""
);
void
SetDebugMode
(
)
{
m_debug
=
true
;
}
void
SetVerbosity
(
int
_level
){
m_verbose
=
_level
;
}
void
SetOutputDirectory
(
std
::
string
_dir
){
m_outputDir
=
_dir
;
}
void
UpdateConsole
(
Long_t
_updateRate
);
void
EnablePlotLabel
(
)
{
m_useLabel
=
true
;
}
Detector
*
GetDetector
(
std
::
string
_detName
);
Alignment2021
*
GetAlignment
(){
return
m_alignment
;
}
void
Run
();
void
Initialize
(
);
void
ProcessEvents
(
);
void
Finalize
(
);
private:
// output file
TFile
*
m_fOut
;
// Output TTree
TTree
*
m_tOut
;
// Output directory
std
::
string
m_outputDir
=
""
;
// vector of pre-detector analysis
std
::
vector
<
Analysis
*
>
m_ana
;
// vector of detector analysis
std
::
vector
<
Analysis
*
>
m_det_ana
;
// Vector of time vectors for DRS4 modules
std
::
vector
<
std
::
vector
<
float
>*
>
m_time
;
//Number of channels to be read
unsigned
int
m_nCh
;
//Number of samples per channel
unsigned
int
m_nSamp
;
//Input file name
std
::
string
m_fNameIn
;
//Input list of files
std
::
string
m_fListOfFiles
;
//Run number
unsigned
int
m_runNumber
;
//Boolean switch to enable the reading of a list of files
bool
m_readListOfFiles
;
//Input file (in case of a single processing)
TFile
*
m_fIn
;
//TChain to accomodate many files (in case of a list of files)
TChain
*
m_fileChain
;
//Vector of detectors placed in the 2018 setup (2 ZDCs, 1 RPD)
std
::
vector
<
Detector
*
>
m_detectors
;
//Vectors of
//Alignment information for the given run
Alignment2021
*
m_alignment
;
//XML parser
XMLSettingsReader
*
m_XMLparser
;
//Current event
int
m_event
;
//Event number of last update
int
m_event_old
=
0
;
//Booleans for analysis selection
bool
m_useZDCs
,
m_usePFRPD
,
m_useTRPD
,
m_useUEM
;
//Boolean to enable plot labelling
bool
m_useLabel
=
false
;
//DebugVariable
bool
m_debug
=
false
;
//Verbosity level
int
m_verbose
=
0
;
//Memory info container for UpdateConsole
MemInfo_t
m_memInfo
;
//CPU info container for UpdateConsole
CpuInfo_t
m_cpuInfo
;
//Process info container for UpdateConsole
ProcInfo_t
m_procInfo
;
};
#endif
Analysis/include/Detector.h
View file @
1d088ad6
...
...
@@ -31,6 +31,7 @@ class Detector{
virtual
double
*
GetPosition
(
)
{
return
m_Position
;
}
virtual
double
*
GetAngle
(
)
{
return
m_Angle
;
}
virtual
Alignment
*
GetAlignment
(
)
{
return
m_Alignment
;
}
virtual
Alignment2021
*
GetAlignment2021
(
)
{
return
m_Alignment2021
;
}
virtual
void
SetNSamples
(
int
_nSamples
)
{
m_nSamp
=
_nSamples
;
}
virtual
void
SetElement
(
Channel
*
_entry
)
{
m_Element
.
push_back
(
_entry
);
}
...
...
@@ -38,12 +39,18 @@ class Detector{
virtual
void
SetAngle
(
double
_cosx
=
0
,
double
_cosy
=
0
,
double
_cosz
=
0
)
{
m_Angle
[
0
]
=
_cosx
;
m_Angle
[
1
]
=
_cosy
;
m_Angle
[
2
]
=
_cosz
;
}
virtual
void
SetBranches
(
TTree
*
_dataTree
);
virtual
void
SetAlignment
(
Alignment
*
_alignment
){
m_Alignment
=
_alignment
;
}
virtual
void
SetAlignment2021
(
Alignment2021
*
_alignment
){
m_Alignment2021
=
_alignment
;
}
virtual
void
DeclareHistograms
(
);
virtual
void
FillHistograms
(
);
virtual
void
PrintMap
(
)
=
0
;
void
SetName
(
std
::
string
_name
)
{
m_name
=
_name
;
}
std
::
string
GetName
(
)
{
return
m_name
;
}
private:
/** Name of the detector **/
std
::
string
m_name
;
/** Vector of channels associated to the dector **/
std
::
vector
<
Channel
*
>
m_Element
;
/** Three element array with x, y, and z of some pre-defined point on the detector **/
...
...
@@ -52,9 +59,10 @@ class Detector{
double
m_Angle
[
3
];
/** Number of samples per channel **/
int
m_nSamp
=
1024
;
/** Alignment of the Testbeam */
/** Alignment of the
2018
Testbeam */
Alignment
*
m_Alignment
=
0
;
/** Alignment of the 2021 Testbeam */
Alignment2021
*
m_Alignment2021
=
0
;
};
#endif
Analysis/include/EM.h
0 → 100644
View file @
1d088ad6
/** @file EM
* @brief Function prototypes for EM
*
* This contains the prototypes and members
* for EM
*
* @author Aric Tate
* @bug No known bugs.
*/
#ifndef EM_H
#define EM_H
#include
"Containers.h"
#include
"Detector.h"
class
EM
:
public
Detector
{
public:
EM
(
);
EM
(
std
::
vector
<
Channel
*
>
_readOut
,
int
_runNumber
,
std
::
string
_name
);
~
EM
(
);
Channel
*
GetElement
(
int
row
,
int
column
);
void
SetnRows
(
int
rows
){
m_nRows
=
rows
;
m_nElements
=
m_nRows
*
m_nColumns
;
ResizeSortedElements
();
};
void
SetnCols
(
int
cols
){
m_nColumns
=
cols
;
m_nElements
=
m_nRows
*
m_nColumns
;
ResizeSortedElements
();
};
int
GetnRows
()
{
return
m_nRows
;
};
int
GetnCols
()
{
return
m_nColumns
;
};
void
ResizeSortedElements
();
virtual
void
PrintMap
(
);
private:
/** Number of rows **/
int
m_nRows
=
3
;
/** Number of columns **/
int
m_nColumns
=
3
;
/** Total elements **/
int
m_nElements
=
m_nRows
*
m_nColumns
;
/** 2D vector of channels sorted in a [row][column] format **/
std
::
vector
<
std
::
vector
<
Channel
*
>
>
m_SortedElements
;
/** Translation of row elements for 2021 testbeam
Converts the tile mapping (row,col)
(1,4) (1,3) (1,2) (0,0) (0,1) (0,2) (0,3)
from (2,4) (2,3) (2,2) to (1,0) (1,1) (1,2) (1,3)
(3,4) (3,3) (3,2) (2,0) (2,1) (2,2) (2,3)
As viewed from the beam souce
**/
int
rowTranslation
[
5
];
/** Translation of column elements for 2018 testbeam
Converts the tile mapping (row,col)
(1,4) (1,3) (1,2) (0,0) (0,1) (0,2)
from (2,4) (2,3) (2,2) to (1,0) (1,1) (1,2)
(3,4) (3,3) (3,2) (2,0) (2,1) (2,2)
As viewed from the beam source**/
int
colTranslation
[
5
];
};
#endif
Analysis/include/EMAnalysis.h
0 → 100644
View file @
1d088ad6
/** @file EMAnalysis
* @brief Function prototypes for EMAnalysis
*
* This contains the prototypes and members
* for EMAnalysis
*
* @author Aric Tate
* @bug No known bugs.
*/
#ifndef EMANALYSIS_H
#define EMANALYSIS_H
#include
"Analysis.h"
#include
"TH2D.h"
#include
"Containers.h"
#include
"EM.h"
#include
<vector>
class
EMAnalysis
:
public
Analysis
{
public
:
EMAnalysis
(
);
virtual
~
EMAnalysis
(
);
virtual
void
Initialize
(
){};
virtual
void
Initialize
(
std
::
vector
<
Detector
*
>
_vDet
);
virtual
void
SetupHistograms
(
);
virtual
void
AnalyzeEvent
(
);
virtual
void
AnalyzeEvent
(
const
std
::
vector
<
TH1
*
>&
){};
virtual
void
AnalyzeEvent
(
const
std
::
vector
<
std
::
vector
<
float
>
>&
){};
virtual
void
AnalyzeEvent
(
const
std
::
vector
<
Channel
*
>
){};
virtual
void
SetBranches
(
TTree
*
_tree
);
virtual
void
Finalize
(
);
/** Running average of charges */
double
m_charge
[
5
][
5
];
/** Running average of charges */
double
m_peak
[
5
][
5
];
/** Center of mass x */
double
m_xCoM
;
/** Center of mass y */
double
m_zCoM
;
/** Sum of all channel charges */
double
ChargeSum
;
/** Sum of all channel peak heights */
double
PeakSum
;
/** Sum of all channel differential peak heights */
double
DiffPeakSum
;
/** Average charge per tile */
TH2D
*
hCharge
;
/** Average peak height per tile */
TH2D
*
hPeak
;
/** Calculated center of mass */
TH2D
*
hCenter
;
/** Charge vs peak height */
TH2D
*
hChgVsPk
;
/** Peak height vs differential peak height */
TH2D
*
hPkVsDiffPk
;
/** Charge sum histogram */
TH1D
*
hChargeSum
;
/** Peak height sum histogram */
TH1D
*
hPeakSum
;
/** Differential peak height sum histogram */
TH1D
*
hDiffPeakSum
;
/** Array of charge histograms. One per tile */
std
::
vector
<
std
::
vector
<
TH1D
*
>
>
hChargeArr
;
/** Array of peak height histograms. One per tile */
std
::
vector
<
std
::
vector
<
TH1D
*
>
>
hPeakArr
;
/** Array of differential peak histograms. One per tile */
std
::
vector
<
std
::
vector
<
TH1D
*
>
>
hDPeakArr
;
/** Center of tiles in X mm */
double
xPos
[
5
]
=
{
-
10.0
,
0.0
,
10.0
,
0
,
0
};
//CHECK FOR 2021!
/** Gap between tiles in Z mm */
double
zPos
[
5
]
=
{
10.0
,
20.0
,
30.0
,
0
,
0
};
//CHECK FOR 2021!
/** Estimated position of the beam calculated form table position */
double
m_beamPosX
,
m_beamPosY
;
/** Number of rows and columns in the EM module */
int
m_numRows
,
m_numCols
;
int
m_counter
;
private
:
/** Pointer to the EM */
EM
*
m_EM
=
0
;
/** Array of pointers to the EM channels to avoid repeated GetElement() calls */
Channel
*
em
[
5
][
5
];
};
#endif
Analysis/include/RPD.h
View file @
1d088ad6
...
...
@@ -18,22 +18,23 @@ class RPD : public Detector{
public:
RPD
(
);
RPD
(
std
::
vector
<
Channel
*
>
_readOut
,
int
_runNumber
);
RPD
(
std
::
vector
<
Channel
*
>
_readOut
,
int
_runNumber
,
std
::
string
m_name
);
~
RPD
(
);
Channel
*
GetElement
(
int
row
,
int
column
);
void
SetnRows
(
int
rows
){
nRows
=
rows
;
nElements
=
nRows
*
nColumns
;
ResizeSortedElements
();
};
void
SetnCols
(
int
cols
){
nColumns
=
cols
;
nElements
=
nRows
*
nColumns
;
ResizeSortedElements
();
};
void
SetnRows
(
int
_
rows
){
m_
nRows
=
_
rows
;
nElements
=
m_
nRows
*
m_
nColumns
;
ResizeSortedElements
();
};
void
SetnCols
(
int
_
cols
){
m_
nColumns
=
_
cols
;
nElements
=
m_
nRows
*
m_
nColumns
;
ResizeSortedElements
();
};
void
ResizeSortedElements
();
virtual
void
PrintMap
(
);
private:
/** Number of rows **/
int
nRows
=
4
;
int
m_
nRows
=
4
;
/** Number of columns **/
int
nColumns
=
4
;
int
m_
nColumns
=
4
;
/** Translation of row elements for 2018 testbeam
Converts the tile mapping (row,col)
(1,4) (1,3) (1,2) (1,1) (0,0) (0,1) (0,2) (0,3)
...
...
@@ -54,7 +55,7 @@ class RPD : public Detector{
As viewed from the beam souce**/
int
colTranslation
[
4
];
/** Total elements **/
int
nElements
=
nRows
*
nColumns
;
int
nElements
=
m_
nRows
*
m_
nColumns
;
/** 2D vector of channels sorted in a [row][column] format **/
std
::
vector
<
std
::
vector
<
Channel
*
>
>
m_SortedElements
;
...
...
Analysis/include/Visualizer.h
View file @
1d088ad6
...
...
@@ -35,8 +35,9 @@ class Visualizer {
void
SetAtlasStyle
();
/** @brief Sets the label to be printed on each plot **/
void
SetTestBeamLabel
(
std
::
string
_category
,
std
::
string
_year
,
std
::
string
_beam
)
{
category
=
_category
;
year
=
_year
;
beam
=
_beam
;
}
void
SetTestBeamLabel
(
std
::
string
_category
,
std
::
string
_year
,
std
::
string
_beam
)
{
m_
category
=
_category
;
m_
year
=
_year
;
m_
beam
=
_beam
;
}
void
SetTestBeamLabel
(
int
runNo
,
Alignment
*
alignment
);
void
SetTestBeamLabel
(
int
runNo
,
Alignment2021
*
alignment
);
/** @brief allow the user to define the extension of the plots once they're printed. ".pdf" by default */
void
SetPlotExtension
(
std
::
string
_extension
)
{
m_extension
=
_extension
;
}
...
...
@@ -61,9 +62,9 @@ class Visualizer {
/** String identifying the style to be applied */
std
::
string
m_style
;
/** Strings encoding the year of the test and the beam **/
std
::
string
category
=
"NO"
;
std
::
string
year
=
"NO"
;
std
::
string
beam
=
"NO"
;
std
::
string
m_
category
=
"NO"
;
std
::
string
m_
year
=
"NO"
;
std
::
string
m_
beam
=
"NO"
;
/** Output folder for plots. Defaults to $JZCaPA/results/ */
std
::
string
m_oFolder
=
"${JZCaPA}/results/"
;
/** Debug flag */
...
...
Analysis/include/ZDC.h
View file @
1d088ad6
...
...
@@ -25,6 +25,8 @@ class ZDC : public Detector{
private:
int
m_Number
;
int
m_runNumber
;
};
#endif
Analysis/src/DataReader.cpp
View file @
1d088ad6
...
...
@@ -252,7 +252,7 @@ void DataReader::LoadConfigurationFile(std::string _inFile ){
if
(
channelEntries
.
size
()
<
18
)
std
::
cout
<<
"WARNING!!!! Number of Channels < 18. Seems that some entry is missed for this run in the config.xml. BE CAREFUL!"
<<
std
::
endl
;
ZDC
*
zdc1
=
new
ZDC
(
channelEntries
,
m_runNumber
,
1
);
ZDC
*
zdc2
=
new
ZDC
(
channelEntries
,
m_runNumber
,
2
);
RPD
*
rpd
=
new
RPD
(
channelEntries
,
m_runNumber
);
RPD
*
rpd
=
new
RPD
(
channelEntries
,
m_runNumber
,
"TRPD18"
);
m_detectors
.
push_back
(
zdc1
);
//Position 0 goes for ZDC1
m_detectors
.
push_back
(
zdc2
);
//Position 1 goes for ZDC2
...
...
@@ -418,12 +418,15 @@ void DataReader::UpdateConsole( Long_t _updateRate){
*/
void
DataReader
::
Run
(){
std
::
cout
<<
"Initializing "
<<
std
::
endl
;
Initialize
();
std
::
cout
<<
"Initialization done "
<<
std
::
endl
;
if
(
!
m_fIn
){
std
::
cerr
<<
"Input file didn't open... exiting"
<<
std
::
endl
;
return
;
}
ProcessEvents
();
std
::
cout
<<
"Events done "
<<
std
::
endl
;
Finalize
();
}
...
...
@@ -483,6 +486,7 @@ void DataReader::Initialize(){
ana
->
Initialize
();
ana
->
SetupHistograms
();
}
std
::
cout
<<
"After loop suspect "
<<
std
::
endl
;
for
(
auto
&
det_ana
:
m_det_ana
){
det_ana
->
Initialize
(
m_detectors
);
det_ana
->
SetupHistograms
();
...
...
@@ -511,13 +515,15 @@ void DataReader::ProcessEvents(){
/** TODO : add reading for list of files
* Please note that many of the implementations are now for a single-file treatment
*/
std
::
cout
<<
"Before retrieving pointers "
<<
std
::
endl
;
TTree
*
tree
=
static_cast
<
TTree
*
>
(
m_fIn
->
Get
(
"tree"
)
);
//Specific pointers to each detector, if needed afterwards
ZDC
*
zdc1
=
static_cast
<
ZDC
*
>
(
GetDetector
(
"ZDC1"
)
);
ZDC
*
zdc2
=
static_cast
<
ZDC
*
>
(
GetDetector
(
"ZDC2"
)
);
RPD
*
rpd
=
static_cast
<
RPD
*
>
(
GetDetector
(
"RPD"
)
);
RPD
*
rpd
=
static_cast
<
RPD
*
>
(
GetDetector
(
"
T
RPD"
)
);
std
::
cout
<<
"Before looping on detectors "
<<
std
::
endl
;
//All the raw channels addresses set for read-out
for
(
uint
detID
=
0
;
detID
<
(
int
)
m_detectors
.
size
();
detID
++
){
m_detectors
.
at
(
detID
)
->
SetBranches
(
tree
);
...
...
Analysis/src/DataReader2021.cpp
0 → 100644
View file @
1d088ad6
/** @defgroup ana Analysis
* @ingroup ana
* @file DataReader2021.cpp
* @brief Implementation of DataReader2021.
*
* Function definitions for DataReader2021 are provided.
* This class reads a rootfile with raw waveforms
* that are processed by rcdaqAnalysis running on prdf files.
* Then, in the event loop, analysis classes can be called.
*
* @author Yakov Kulinich, Riccardo Longo
* @bug No known bugs.
*/
#include
<TFile.h>
#include
<TTree.h>
#include
<iostream>
#include
<fstream>
#include
"DataReader2021.h"
#include
"Analysis.h"
#include
"Containers.h"
#include
"RPD.h"
#include
"ZDC.h"
#include
"EM.h"
#include
"Visualizer.h"
/** @brief Default Constructor for DataReader2021.
*/
DataReader2021
::
DataReader2021
()
:
DataReader2021
(
0
,
0
,
""
,
0
){
}
/** @brief Constructor for DataReader2021.
*
* @param nCh Number of channels being read
* @param nSamp Number of samples per channel
*/
DataReader2021
::
DataReader2021
(
const
unsigned
int
nCh
,
const
unsigned
int
nSamp
)
:
DataReader2021
(
nCh
,
nSamp
,
""
,
0
){
// here say we will read in list of files, maybe
// there is better way to do it, just an idea for now.
m_readListOfFiles
=
true
;
}
/** @brief Constructor for DataReader2021.
*
* @param nCh Number of channels being read
* @param nSamp Number of samples per channel
* @param fNameIn Input filename.
*/
DataReader2021
::
DataReader2021
(
const
uint
nCh
,
const
uint
nSamp
,
const
std
::
string
&
fNameIn
)
:
DataReader2021
(
nCh
,
nSamp
,
fNameIn
,
0
){
}
/** @brief Constructor for DataReader2021.
*
* @param nCh Number of channels being read
* @param nSamp Number of samples per channel
* @param4 fNameIn Output file name (custom)
* @param3 runNum Run number being used.
*/
DataReader2021
::
DataReader2021
(
const
uint
nCh
,
const
uint
nSamp
,
const
std
::
string
&
fNameIn
,
const
uint
runNum
)
:
m_nCh
(
nCh
),
m_nSamp
(
nSamp
),
m_fNameIn
(
fNameIn
),
m_runNumber
(
runNum
),
m_readListOfFiles
(
false
),
m_fIn
(
NULL
){
}
/** @brief Destructor for DataReader2021.
*/
DataReader2021
::~
DataReader2021
(){
for
(
auto
&
time
:
m_time
){
delete
time
;
time
=
NULL
;
}
for
(
auto
&
det
:
m_detectors
){
delete
det
;
det
=
NULL
;
}
for
(
auto
&
ana
:
m_ana
){
delete
ana
;
ana
=
NULL
;