mirror of
https://github.com/sesps/SPS_SABRE_EventBuilder.git
synced 2024-11-22 10:08:50 -05:00
Compare commits
7 Commits
51d97d1755
...
ca0a7066df
Author | SHA1 | Date | |
---|---|---|---|
ca0a7066df | |||
Gordon McCann | 45763dce66 | ||
Gordon McCann | e9c50331f7 | ||
Gordon McCann | a264eea63c | ||
Gordon McCann | 4886c497a3 | ||
Gordon McCann | c4557c2b26 | ||
ccd31cda52 |
|
@ -42,6 +42,7 @@ namespace EventBuilder {
|
||||||
m_eofFlag = false;
|
m_eofFlag = false;
|
||||||
m_hitUsedFlag = true;
|
m_hitUsedFlag = true;
|
||||||
m_filename = filename;
|
m_filename = filename;
|
||||||
|
m_nHits = 0;
|
||||||
m_file->open(m_filename, std::ios::binary | std::ios::in);
|
m_file->open(m_filename, std::ios::binary | std::ios::in);
|
||||||
m_file->seekg(0, std::ios_base::end);
|
m_file->seekg(0, std::ios_base::end);
|
||||||
m_size = m_file->tellg();
|
m_size = m_file->tellg();
|
||||||
|
|
|
@ -58,6 +58,7 @@ namespace EventBuilder {
|
||||||
m_analyzedDir = m_workspace + "analyzed/";
|
m_analyzedDir = m_workspace + "analyzed/";
|
||||||
m_histogramDir = m_workspace + "histograms/";
|
m_histogramDir = m_workspace + "histograms/";
|
||||||
m_cutDir = m_workspace + "cuts/";
|
m_cutDir = m_workspace + "cuts/";
|
||||||
|
m_mergedDir = m_workspace + "merged/";
|
||||||
|
|
||||||
//Check all subdirectories. Terminate if any of them are bad
|
//Check all subdirectories. Terminate if any of them are bad
|
||||||
m_isValid = CheckSubDirectory(m_binaryDir);
|
m_isValid = CheckSubDirectory(m_binaryDir);
|
||||||
|
@ -79,6 +80,9 @@ namespace EventBuilder {
|
||||||
if(!m_isValid)
|
if(!m_isValid)
|
||||||
return;
|
return;
|
||||||
m_isValid = CheckSubDirectory(m_cutDir);
|
m_isValid = CheckSubDirectory(m_cutDir);
|
||||||
|
if(!m_isValid)
|
||||||
|
return;
|
||||||
|
m_isValid = CheckSubDirectory(m_mergedDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string EVBWorkspace::GetBinaryRun(int run)
|
std::string EVBWorkspace::GetBinaryRun(int run)
|
||||||
|
@ -126,9 +130,11 @@ namespace EventBuilder {
|
||||||
std::vector<std::string> list;
|
std::vector<std::string> list;
|
||||||
std::string temp;
|
std::string temp;
|
||||||
for(int run=runMin; run<=runMax; run++)
|
for(int run=runMin; run<=runMax; run++)
|
||||||
|
{
|
||||||
temp = GetAnalyzedRun(run);
|
temp = GetAnalyzedRun(run);
|
||||||
if(!temp.empty())
|
if(!temp.empty())
|
||||||
list.push_back(temp);
|
list.push_back(temp);
|
||||||
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +193,7 @@ namespace EventBuilder {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TFile* output = TFile::Open(outputname.c_str(), "RECREATE");
|
TFile* output = TFile::Open(outputname.c_str(), "RECREATE");
|
||||||
if(!output->IsOpen())
|
if(!output || !output->IsOpen())
|
||||||
{
|
{
|
||||||
EVB_ERROR("Could not open output file {0} for merge", outputname);
|
EVB_ERROR("Could not open output file {0} for merge", outputname);
|
||||||
output->Close();
|
output->Close();
|
||||||
|
@ -196,8 +202,15 @@ namespace EventBuilder {
|
||||||
|
|
||||||
TChain* chain = new TChain("SPSTree", "SPSTree");
|
TChain* chain = new TChain("SPSTree", "SPSTree");
|
||||||
for(auto& entry : files)
|
for(auto& entry : files)
|
||||||
|
{
|
||||||
|
EVB_INFO("Merging file: {0}", entry);
|
||||||
chain->Add(entry.c_str());
|
chain->Add(entry.c_str());
|
||||||
chain->Merge(output, 0, "fast");
|
}
|
||||||
|
//Note: TChain merge is kinda fucked. It requires a file passed in, which it then implicitly takes ownership of.
|
||||||
|
//By passing the keep option, we tell TChain we want to keep ownership of the file (otherwise it will automatically close and delete)
|
||||||
|
//We need ownership because the Merge function does not do a good job of handling errors explicitly.
|
||||||
|
chain->Merge(output, 0, "fast|keep");
|
||||||
|
|
||||||
output->Close();
|
output->Close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace EventBuilder {
|
||||||
/*Makes histograms where only rejection is unset data*/
|
/*Makes histograms where only rejection is unset data*/
|
||||||
void SFPPlotter::MakeUncutHistograms(const ProcessedEvent& ev, THashTable* table)
|
void SFPPlotter::MakeUncutHistograms(const ProcessedEvent& ev, THashTable* table)
|
||||||
{
|
{
|
||||||
MyFill(table,"x1NoCuts_bothplanes",600,-300,300,ev.x2);
|
MyFill(table,"x1NoCuts_bothplanes",600,-300,300,ev.x1);
|
||||||
MyFill(table,"x2NoCuts_bothplanes",600,-300,300,ev.x2);
|
MyFill(table,"x2NoCuts_bothplanes",600,-300,300,ev.x2);
|
||||||
MyFill(table,"xavgNoCuts_bothplanes",600,-300,300,ev.xavg);
|
MyFill(table,"xavgNoCuts_bothplanes",600,-300,300,ev.xavg);
|
||||||
MyFill(table,"xavgNoCuts_theta_bothplanes",600,-300,300,ev.xavg,100,0,TMath::Pi()/2.,ev.theta);
|
MyFill(table,"xavgNoCuts_theta_bothplanes",600,-300,300,ev.xavg,100,0,TMath::Pi()/2.,ev.theta);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user