Skip to content
Snippets Groups Projects
Commit ef80b223 authored by Chad Lantz's avatar Chad Lantz
Browse files

Fixed behavior of Initialize, updated SetBranches with vectors and added an output plot

parent 4694fd3e
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ class Scintillators : public Detector{
public:
Scintillators( );
Scintillators(std::vector<Channel *> _readOut, int _runNumber );
Scintillators(std::vector<Channel *> _readOut, int _runNumber, std::string _name );
virtual ~Scintillators( );
void PrintMap ( );
......
......@@ -14,7 +14,7 @@
#include "Analysis.h"
#include "TH2D.h"
#include "Containers.h"
#include "Detector.h"
#include "Scintillators.h"
class ScintillatorsAnalysis2021 : public Analysis{
......@@ -36,13 +36,7 @@ class ScintillatorsAnalysis2021 : public Analysis{
private :
/** Pointer to the Large Horizontal Scintillator (Trigger) */
Detector *m_scintillatorLH = 0;
/** Pointer to the second Scintillators module */
Detector *m_scintillatorLV = 0;
/** Pointer to the third Scintillators module */
Detector *m_scintillatorSH = 0;
/** Pointer to the third Scintillators module */
Detector *m_scintillatorSV = 0;
Scintillators *m_scintillator = 0;
/** Pointer to the LV channel */
Channel* m_sciLV = 0;
/** Pointer to the LH channel */
......@@ -51,6 +45,8 @@ class ScintillatorsAnalysis2021 : public Analysis{
Channel* m_sciSV = 0;
/** Pointer to the SH channel */
Channel* m_sciSH = 0;
/** Charge histo */
TH2D *hPeak;
};
......
......@@ -27,8 +27,9 @@ Scintillators::Scintillators( ){
* relevant Channel from the input vector.
*
*/
Scintillators::Scintillators( std::vector < Channel* > _readOut, int _runNumber ){
Scintillators::Scintillators( std::vector < Channel* > _readOut, int _runNumber, std::string _name ){
SetName(_name);
m_runNumber = _runNumber;
for(int i = 0; i < (int)_readOut.size(); i++){
if((_readOut.at(i)->detector.find("TRIG") != std::string::npos)){
......@@ -55,7 +56,7 @@ Channel* Scintillators::GetScintillator( std::string _scintillatorID ){
}
}
std::cout << "ERROR! Scintillator " << _scintillatorID << " not found " << std::endl;
return NULL;
}
/** @brief From channel returns the Scintillator ID **/
std::string Scintillators::FindPaddleType( Channel *c ){
......@@ -68,6 +69,9 @@ std::string Scintillators::FindPaddleType( Channel *c ){
return "SV";
if(c->mapping_row == 2 && c->mapping_column == 2)
return "SH";
//Default behavior
return "";
}
/** @brief Prints a map of the Scintillators to the terminal
*
......
......@@ -17,7 +17,6 @@
#include "Containers.h"
#include "TH2D.h"
#include "TH1.h"
#include "TCanvas.h"
#include "Visualizer.h"
/** @brief Default Constructor for ScintillatorsAnalysis2021.
......@@ -53,32 +52,15 @@ void ScintillatorsAnalysis2021::Initialize( std::vector < Detector* > _vDet ){
std::cout << "======================= Beginning of ScintillatorsAnalysis2021 =======================" << std::endl;
for( auto& det : _vDet ){
if( det->GetChannelsVector().at(0)->detector == "TRIGGER"
&& det->GetChannelsVector()[0]->mapping_row == 1
&& det->GetChannelsVector()[0]->mapping_column == 1){
m_scintillatorLV = (Scintillators*)det;
m_sciLV = det->GetElement(1,1);
}
if( det->GetChannelsVector().at(0)->detector == "TRIGGER"
&& det->GetChannelsVector()[0]->mapping_row == 1
&& det->GetChannelsVector()[0]->mapping_column == 2){
m_scintillatorLH = (Scintillators*)det;
m_sciLH = det->GetElement(1,2);
}
if( det->GetChannelsVector().at(0)->detector == "TRIGGER"
&& det->GetChannelsVector()[0]->mapping_row == 2
&& det->GetChannelsVector()[0]->mapping_column == 1){
m_scintillatorSV = (Scintillators*)det;
m_sciSV = det->GetElement(2,1);
}
if( det->GetChannelsVector().at(0)->detector == "TRIGGER"
&& det->GetChannelsVector()[0]->mapping_row == 2
&& det->GetChannelsVector()[0]->mapping_column == 2){
m_scintillatorSH = (Scintillators*)det;
m_sciSH = det->GetElement(2,2);
if( det->GetChannelsVector().at(0)->detector == "TRIGGER"){
m_scintillator = (Scintillators*)det;
m_sciLV = det->GetElement(1,1);
m_sciLH = det->GetElement(1,2);
m_sciSV = det->GetElement(2,1);
m_sciSH = det->GetElement(2,2);
}
}
m_alignment = m_scintillatorLH->GetAlignment();
m_alignment2021 = m_scintillator->GetAlignment2021();
}
......@@ -90,6 +72,8 @@ void ScintillatorsAnalysis2021::Initialize( std::vector < Detector* > _vDet ){
*/
void ScintillatorsAnalysis2021::SetupHistograms( ){
hPeak = new TH2D("trig_peak","Trigger Peak",100,0,300,100,0,300);
}
/** @brief Branch setup method for ScintillatorsAnalysis2021
......@@ -101,41 +85,33 @@ void ScintillatorsAnalysis2021::SetBranches( TTree* _tree ){
m_AnalysisTree = _tree;
//The tree output in this class is set to be equal to the one of the ZDC channels.
//Large Vertical scintillator
m_AnalysisTree->Branch("LV_Charge", &m_sciLV->Charge, "LV_Charge/D" );
m_AnalysisTree->Branch("LV_Peak_max", &m_sciLV->Peak_max, "LV_Peak_max/D" );
m_AnalysisTree->Branch("LV_Diff_max", &m_sciLV->Diff_max, "LV_Diff_max/D" );
m_AnalysisTree->Branch("LV_Peak_center", &m_sciLV->Peak_center, "LV_Peak_center/I" );
m_AnalysisTree->Branch("LV_Peak_time", &m_sciLV->Peak_time, "LV_Peak_time/D" );
m_AnalysisTree->Branch("LV_Diff_Peak_center", &m_sciLV->Diff_Peak_center, "LV_Diff_Peak_center/I" );
m_AnalysisTree->Branch("LV_Diff_Peak_time", &m_sciLV->Diff_Peak_time, "LV_Diff_Peak_time/D" );
m_AnalysisTree->Branch("LV_Ped_mean", &m_sciLV->PedMean, "LV_Ped_mean/D" );
m_AnalysisTree->Branch("LV_Charge", "std::vector<double>", &m_sciLV->Charge );
m_AnalysisTree->Branch("LV_Peak_max", "std::vector<double>", &m_sciLV->Peak_max );
m_AnalysisTree->Branch("LV_Diff_max", "std::vector<double>", &m_sciLV->Diff_max );
m_AnalysisTree->Branch("LV_Peak_time", "std::vector<double>", &m_sciLV->Peak_time );
m_AnalysisTree->Branch("LV_Diff_Peak_time", "std::vector<double>", &m_sciLV->Diff_Peak_time );
m_AnalysisTree->Branch("LV_Ped_mean", &m_sciLV->PedMean, "LV_Ped_mean/D" );
//Large Horizontal Scintillator
m_AnalysisTree->Branch("LH_Charge", &m_sciLH->Charge, "LH_Charge/D" );
m_AnalysisTree->Branch("LH_Peak_max", &m_sciLH->Peak_max, "LH_Peak_max/D" );
m_AnalysisTree->Branch("LH_Diff_max", &m_sciLH->Diff_max, "LH_Diff_max/D" );
m_AnalysisTree->Branch("LH_Peak_center", &m_sciLH->Peak_center, "LH_Peak_center/I" );
m_AnalysisTree->Branch("LH_Peak_time", &m_sciLH->Peak_time, "LH_Peak_time/D" );
m_AnalysisTree->Branch("LH_Diff_Peak_center", &m_sciLH->Diff_Peak_center, "LH_Diff_Peak_center/I" );
m_AnalysisTree->Branch("LH_Diff_Peak_time", &m_sciLH->Diff_Peak_time, "LH_Diff_Peak_time/D" );
m_AnalysisTree->Branch("LH_Ped_mean", &m_sciLH->PedMean, "LH_Ped_mean/D" );
m_AnalysisTree->Branch("LH_Charge", "std::vector<double>", &m_sciLH->Charge );
m_AnalysisTree->Branch("LH_Peak_max", "std::vector<double>", &m_sciLH->Peak_max );
m_AnalysisTree->Branch("LH_Diff_max", "std::vector<double>", &m_sciLH->Diff_max );
m_AnalysisTree->Branch("LH_Peak_time", "std::vector<double>", &m_sciLH->Peak_time );
m_AnalysisTree->Branch("LH_Diff_Peak_time", "std::vector<double>", &m_sciLH->Diff_Peak_time );
m_AnalysisTree->Branch("LH_Ped_mean", &m_sciLH->PedMean, "LH_Ped_mean/D" );
//Small Vertical Scintillator
m_AnalysisTree->Branch("SV_Charge", &m_sciSV->Charge, "SV_Charge/D" );
m_AnalysisTree->Branch("SV_Peak_max", &m_sciSV->Peak_max, "SV_Peak_max/D" );
m_AnalysisTree->Branch("SV_Diff_max", &m_sciSV->Diff_max, "SV_Diff_max/D" );
m_AnalysisTree->Branch("SV_Peak_center", &m_sciSV->Peak_center, "SV_Peak_center/I" );
m_AnalysisTree->Branch("SV_Peak_time", &m_sciSV->Peak_time, "SV_Peak_time/D" );
m_AnalysisTree->Branch("SV_Diff_Peak_center", &m_sciSV->Diff_Peak_center, "SV_Diff_Peak_center/I" );
m_AnalysisTree->Branch("SV_Diff_Peak_time", &m_sciSV->Diff_Peak_time, "SV_Diff_Peak_time/D" );
m_AnalysisTree->Branch("SV_Ped_mean", &m_sciSV->PedMean, "SV_Ped_mean/D" );
m_AnalysisTree->Branch("SV_Charge", "std::vector<double>", &m_sciSV->Charge );
m_AnalysisTree->Branch("SV_Peak_max", "std::vector<double>", &m_sciSV->Peak_max );
m_AnalysisTree->Branch("SV_Diff_max", "std::vector<double>", &m_sciSV->Diff_max );
m_AnalysisTree->Branch("SV_Peak_time", "std::vector<double>", &m_sciSV->Peak_time );
m_AnalysisTree->Branch("SV_Diff_Peak_time", "std::vector<double>", &m_sciSV->Diff_Peak_time );
m_AnalysisTree->Branch("SV_Ped_mean", &m_sciSV->PedMean, "SV_Ped_mean/D" );
//Small Horizontal Scintillator
m_AnalysisTree->Branch("SH_Charge", &m_sciSH->Charge, "SH_Charge/D" );
m_AnalysisTree->Branch("SH_Peak_max", &m_sciSH->Peak_max, "SH_Peak_max/D" );
m_AnalysisTree->Branch("SH_Diff_max", &m_sciSH->Diff_max, "SH_Diff_max/D" );
m_AnalysisTree->Branch("SH_Peak_center", &m_sciSH->Peak_center, "SH_Peak_center/I" );
m_AnalysisTree->Branch("SH_Peak_time", &m_sciSH->Peak_time, "SH_Peak_time/D" );
m_AnalysisTree->Branch("SH_Diff_Peak_center", &m_sciSH->Diff_Peak_center, "SH_Diff_Peak_center/I" );
m_AnalysisTree->Branch("SH_Diff_Peak_time", &m_sciSH->Diff_Peak_time, "SH_Diff_Peak_time/D" );
m_AnalysisTree->Branch("SH_Ped_mean", &m_sciSH->PedMean, "SH_Ped_mean/D" );
m_AnalysisTree->Branch("SH_Charge", "std::vector<double>", &m_sciSH->Charge );
m_AnalysisTree->Branch("SH_Peak_max", "std::vector<double>", &m_sciSH->Peak_max );
m_AnalysisTree->Branch("SH_Diff_max", "std::vector<double>", &m_sciSH->Diff_max );
m_AnalysisTree->Branch("SH_Peak_time", "std::vector<double>", &m_sciSH->Peak_time );
m_AnalysisTree->Branch("SH_Diff_Peak_center", "std::vector<int>", &m_sciSH->Diff_Peak_center );
m_AnalysisTree->Branch("SH_Ped_mean", &m_sciSH->PedMean, "SH_Ped_mean/D" );
}
/** @brief Analyze Events method for ScintillatorsAnalysis2021
......@@ -143,7 +119,54 @@ void ScintillatorsAnalysis2021::SetBranches( TTree* _tree ){
*
*/
void ScintillatorsAnalysis2021::AnalyzeEvent( ){
int lvHit=-1, lhHit=-1, svHit=-1, shHit=-1;
double lvPeak=-1, lhPeak=-1, svPeak=-1, shPeak=-1;
//Get large vertical scintillator peak value
for(int hit = 0; hit < m_sciLV->Peak_max.size(); hit++){
if(m_sciLV->Peak_center.at(hit) > 200 && m_sciLV->Peak_center.at(hit) < 300){
lvHit = hit;
lvPeak = m_sciLV->Peak_max.at(hit);
break;
}
}
//If there was no hit in our range, set the peak value to zero
if( lvHit == -1 ) lvPeak = 0;
//Get large vertical scintillator peak value
for(int hit = 0; hit < m_sciLH->Peak_max.size(); hit++){
if(m_sciLH->Peak_center.at(hit) > 200 && m_sciLH->Peak_center.at(hit) < 300){
lhHit = hit;
lhPeak = m_sciLH->Peak_max.at(hit);
break;
}
}
//If there was no hit in our range, set the peak value to zero
if( lhHit == -1 ) lhPeak = 0;
//Get large vertical scintillator peak value
for(int hit = 0; hit < m_sciSV->Peak_max.size(); hit++){
if(m_sciSV->Peak_center.at(hit) > 200 && m_sciSV->Peak_center.at(hit) < 300){
svHit = hit;
svPeak = m_sciSV->Peak_max.at(hit);
break;
}
}
//If there was no hit in our range, set the peak value to zero
if( svHit == -1 ) svPeak = 0;
//Get large vertical scintillator peak value
for(int hit = 0; hit < m_sciSH->Peak_max.size(); hit++){
if(m_sciSH->Peak_center.at(hit) > 200 && m_sciSH->Peak_center.at(hit) < 300){
shHit = hit;
shPeak = m_sciSH->Peak_max.at(hit);
break;
}
}
//If there was no hit in our range, set the peak value to zero
if( shHit == -1 ) shPeak = 0;
hPeak->Fill(lvPeak+lhPeak,svPeak+shPeak);
}
......@@ -156,23 +179,8 @@ void ScintillatorsAnalysis2021::Finalize( ){
std::string output = std::getenv("JZCaPA");
output += "/results/";
TCanvas *c = new TCanvas("ScintillatorsAnalysis2021","ScintillatorsAnalysis2021",800,600);
if(m_viz == NULL) m_viz = new Visualizer( "ATLAS" );
/*
std::vector<TH1*> hist1D_vec;
std::vector<TH1*> hist2D_vec;
hist1D_vec.push_back(hCharge1); hist1D_vec.push_back(hCharge2); hist1D_vec.push_back(hCharge3);
m_viz->SimplePadsPlot( hist1D_vec, 3, 1, "Q_{ZDC} (pC)","Counts", "HAD[1-3]_Charge1D.png", "HAD", ""); hist1D_vec.clear();
c->cd();
m_viz->DrawPlot(hCharge,"Q_{m_sciLV} (pC)","Q_{ZDC2} (pC)","ZDC_charge.png","COLZ");//OUTDATED
*/
delete c;
m_viz->DrawPlot(hPeak,"Large Scintillator Peak Sum [ADC]","Small Scintillator Peak Sum [ADC]","Trig_Peak.png","COLZ");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment