Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion DataModel/Channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ class Channel : public SerialisableObject{
ar & hv_card;
ar & hv_channel;
ar & status;
ar & channelType;
if(version > 0) ar & channelType;
}
}

};

BOOST_CLASS_VERSION(Channel, 1)

#endif
8 changes: 6 additions & 2 deletions DataModel/LAPPDPulse.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ class LAPPDPulse : public Hit{
ar & halfHeightTime;
ar & halfEndTime;
ar & baseline;
ar & pulseFollowTime;
ar & pulseFollowCharge;
if(version>0){
ar & pulseFollowTime;
ar & pulseFollowCharge;
}
}
}
};

BOOST_CLASS_VERSION(LAPPDPulse, 1)

/* Derived classes, if there's a reason to have them. So far...not really

class TDCHit : public Hit {
Expand Down
12 changes: 12 additions & 0 deletions UserTools/ANNIEEventTreeMaker/ANNIEEventTreeMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,18 @@ bool ANNIEEventTreeMaker::Execute()

bool ANNIEEventTreeMaker::Finalise()
{
if (MCTruth_fill) {
delete fTrueNeutCapVtxX;
delete fTrueNeutCapVtxY;
delete fTrueNeutCapVtxZ;
delete fTrueNeutCapNucleus;
delete fTrueNeutCapTime;
delete fTrueNeutCapGammas;
delete fTrueNeutCapE;
delete fTrueNeutCapGammaE;
delete fTruePrimaryPdgs;
}

Log("ANNIEEventTreeMaker Tool: Got " + std::to_string(processedEvents) + " events", 0, ANNIEEventTreeMakerVerbosity);
fOutput_tfile->cd();
fANNIETree->Write();
Expand Down
12 changes: 6 additions & 6 deletions UserTools/EBLAPPD/EBLAPPD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ bool EBLAPPD::LoadLAPPDData()

bool EBLAPPD::Matching(int targetTrigger, int matchToTrack)
{
cout << "\033[1;34m******* EBLAPPD : Matching *******\033[0m" << endl;
Log("\033[1;34m******* EBLAPPD : Matching *******\033[0m", v_message, verbosityEBLAPPD);
Log("EBLAPPD: Matching LAPPD data with target trigger " + std::to_string(targetTrigger) + " in track " + std::to_string(matchToTrack), v_message, verbosityEBLAPPD);

std::map<int, std::vector<std::map<uint64_t, uint32_t>>> GroupedTriggersInTotal; // each map is a group of triggers, with the key is the target trigger word
Expand Down Expand Up @@ -308,7 +308,7 @@ bool EBLAPPD::Matching(int targetTrigger, int matchToTrack)
int matchedTrack = 0;
int matchedIndex = 0;

for (std::pair<int, std::vector<std::map<uint64_t, uint32_t>>> pair : GroupedTriggersInTotal)
for (const std::pair<int, std::vector<std::map<uint64_t, uint32_t>>>& pair : GroupedTriggersInTotal)
{
int TrackTriggerWord = pair.first;
if (matchedNumberInTrack.find(TrackTriggerWord) == matchedNumberInTrack.end())
Expand All @@ -318,13 +318,13 @@ bool EBLAPPD::Matching(int targetTrigger, int matchToTrack)
// Log("EBLAPPD: Skipping TrackTriggerWord " + std::to_string(TrackTriggerWord), v_debug, verbosityEBLAPPD);
continue;
}
vector<std::map<uint64_t, uint32_t>> GroupedTriggers = pair.second;
const vector<std::map<uint64_t, uint32_t>>& GroupedTriggers = pair.second;

for (int j = 0; j < GroupedTriggers.size(); j++)
{
map<uint64_t, uint32_t> groupedTrigger = GroupedTriggers.at(j);
const map<uint64_t, uint32_t>& groupedTrigger = GroupedTriggers.at(j);
// itearte over all the grouped triggers, if the value is target trigger, then calculate the time difference
for (std::pair<uint64_t, uint32_t> p : groupedTrigger)
for (const std::pair<uint64_t, uint32_t>& p : groupedTrigger)
{
if (matchToAllTriggers || p.second == targetTrigger)
{
Expand Down Expand Up @@ -379,4 +379,4 @@ bool EBLAPPD::Matching(int targetTrigger, int matchToTrack)
}

return true;
}
}
4 changes: 4 additions & 0 deletions UserTools/EBLoadRaw/EBLoadRaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ std::vector<std::string> EBLoadRaw::OrganizeRunParts(std::string FileList)
OrganizedFiles.push_back(SortingVector.at(j).second);
}
}
else
{
std::cerr << "EBLoadRaw::OrganizeRunParts: Failed to open file list " << FileList << std::endl;
}
// print the OrganizedFiles
for (int i = 0; i < (int)OrganizedFiles.size(); i++)
{
Expand Down
28 changes: 14 additions & 14 deletions UserTools/EBMRD/EBMRD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ bool EBMRD::Execute()
Log("EBMRD: Current buffer size is " + std::to_string(MRDEventsBuffer.size()), v_message, verbosityEBMRD);
// loop the MRDEvents, save every event to MRDEventsBuffer if it's not already in the buffer
int newLoadedEvents = 0;
for (std::pair<uint64_t, std::vector<std::pair<unsigned long, int>>> p : MRDEvents)
for (const std::pair<uint64_t, std::vector<std::pair<unsigned long, int>>>& p : MRDEvents)
{
uint64_t MTCtime = p.first;
std::vector<std::pair<unsigned long, int>> WaveMap = p.second;
const uint64_t MTCtime = p.first;
const std::vector<std::pair<unsigned long, int>>& WaveMap = p.second;
// if find the MTCtime in the PairedMRDTimeStamps, then skip
if (PairedMRDTimeStamps.size() > 0)
{
bool skip = false;
for (std::pair<int, std::vector<uint64_t>> pair : PairedMRDTimeStamps)
for (const std::pair<int, std::vector<uint64_t>>& pair : PairedMRDTimeStamps)
{
for (uint64_t t : pair.second)
for (const uint64_t t : pair.second)
{
if (t == MTCtime)
{
Expand Down Expand Up @@ -135,7 +135,7 @@ bool EBMRD::Finalise()

bool EBMRD::Matching(int targetTrigger, int matchToTrack)
{
cout << "\033[1;34m******* EBMRD : Matching *******\033[0m" << endl;
Log("\033[1;34m******* EBMRD : Matching *******\033[0m", v_message, verbosityEBMRD);
std::map<int, std::vector<std::map<uint64_t, uint32_t>>> GroupedTriggersInTotal; // each map is a group of triggers, with the key is the target trigger word
m_data->CStore.Get("GroupedTriggersInTotal", GroupedTriggersInTotal);

Expand All @@ -148,20 +148,20 @@ bool EBMRD::Matching(int targetTrigger, int matchToTrack)
// in each group of trigger, find the target trigger word and it's time
// fine the minimum time difference, if smaller than matchTolerance_ns, then save the time to PairedCTCTimeStamps and PairedMRDTimeStamps
int loopNum = 0;
for (std::pair<uint64_t, std::vector<std::pair<unsigned long, int>>> mrdpair : MRDEventsBuffer)
for (const std::pair<uint64_t, std::vector<std::pair<unsigned long, int>>>& mrdpair : MRDEventsBuffer)
{
if (verbosityEBMRD > 11)
cout << "******************EBMRD: new MRD event: " << loopNum << endl;
uint64_t MTCtime = mrdpair.first;
std::vector<std::pair<unsigned long, int>> WaveMap = mrdpair.second;
const uint64_t MTCtime = mrdpair.first;
const std::vector<std::pair<unsigned long, int>>& WaveMap = mrdpair.second;
// set minDT to 5 min
uint64_t minDT = 5 * 60 * 1e9;
uint64_t minDTTrigger = 0;
uint64_t dt = 0;
uint32_t matchedTrigWord = 0;
int matchedTrack = 0;
int matchedIndex = 0;
for (std::pair<int, std::vector<std::map<uint64_t, uint32_t>>> pair : GroupedTriggersInTotal)
for (const std::pair<int, std::vector<std::map<uint64_t, uint32_t>>>& pair : GroupedTriggersInTotal)
{
int TrackTriggerWord = pair.first;
if (TrackTriggerWord != matchToTrack && !matchToAllTriggers)
Expand All @@ -172,13 +172,13 @@ bool EBMRD::Matching(int targetTrigger, int matchToTrack)
if (matchedNumberInTrack.find(TrackTriggerWord) == matchedNumberInTrack.end())
matchedNumberInTrack.emplace(TrackTriggerWord, 0);

vector<std::map<uint64_t, uint32_t>> groupedTriggers = pair.second;
const vector<std::map<uint64_t, uint32_t>>& groupedTriggers = pair.second;

for (int i = 0; i < groupedTriggers.size(); i++)
{
map<uint64_t, uint32_t> groupedTrigger = groupedTriggers.at(i);
const map<uint64_t, uint32_t>& groupedTrigger = groupedTriggers.at(i);
// itearte over all the grouped triggers, if the value is target trigger, then calculate the time difference
for (std::pair<uint64_t, uint32_t> p : groupedTrigger)
for (const std::pair<uint64_t, uint32_t>& p : groupedTrigger)
{
if (matchToAllTriggers || p.second == targetTrigger)
{
Expand Down Expand Up @@ -234,4 +234,4 @@ bool EBMRD::Matching(int targetTrigger, int matchToTrack)
}

return true;
}
}
31 changes: 16 additions & 15 deletions UserTools/EBSaver/EBSaver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,10 @@ bool EBSaver::Initialise(std::string configfile, DataModel &data)
m_data->CStore.Get("AmBeTriggerMain", AmBeTriggerMain);
m_data->CStore.Get("PPSMain", PPSMain);

InProgressHits = new std::map<uint64_t, std::map<unsigned long, std::vector<Hit>> *>;
InProgressChkey = new std::map<uint64_t, std::vector<unsigned long>>;
InProgressRecoADCHits = new std::map<uint64_t, std::map<unsigned long, std::vector<std::vector<ADCPulse>>>>;
InProgressRecoADCHitsAux = new std::map<uint64_t, std::map<unsigned long, std::vector<std::vector<ADCPulse>>>>;
InProgressHitsAux = new std::map<uint64_t, std::map<unsigned long, std::vector<Hit>> *>;
FinishedRawAcqSize = new std::map<uint64_t, std::map<unsigned long, std::vector<int>>>;

RWMRawWaveforms = new std::map<uint64_t, std::vector<uint16_t>>;
BRFRawWaveforms = new std::map<uint64_t, std::vector<uint16_t>>;

if (saveBeamInfo)
{
Log("EBSaver: saveBeamInfo is true, loading Beam Info", v_message, verbosityEBSaver);
LoadBeamInfo();
return LoadBeamInfo();
}

return true;
Expand Down Expand Up @@ -1304,16 +1294,25 @@ void EBSaver::BuildEmptyLAPPDData()
ANNIEEvent->Set("LAPPDTS_PPSMissing", LAPPDTS_PPSMissing);
}

void EBSaver::LoadBeamInfo()
bool EBSaver::LoadBeamInfo()
{
TFile *file = new TFile(beamInfoFileName.c_str(), "READ");

if (file->IsZombie()) {
delete file;
Log("EBSaver: Failed to load beam info from file with name: " + beamInfoFileName, v_error, verbosityEBSaver);
return false;
}

TTree *tree;
file->GetObject("BeamTree", tree);

if (!tree)
{
cout << "EBSaver: Failed to load beam info from file with name: " << beamInfoFileName << endl;
return;
file->Close();
delete file;
Log("EBSaver: Failed to load beam info from file with name: " + beamInfoFileName, v_error, verbosityEBSaver);
return false;
}

// copy from IFBeamDBInterfaceV2.cpp
Expand Down Expand Up @@ -1401,7 +1400,9 @@ void EBSaver::LoadBeamInfo()

Log("EBSaver: Finished loading beam info from " + beamInfoFileName, v_message, verbosityEBSaver);

return;
file->Close();
delete file;
return true;
}

bool EBSaver::SaveBeamInfo(uint64_t TriggerTime)
Expand Down
2 changes: 1 addition & 1 deletion UserTools/EBSaver/EBSaver.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class EBSaver : public Tool
void BuildEmptyMRDData();
void BuildEmptyLAPPDData();

void LoadBeamInfo();
bool LoadBeamInfo();

private:
int saveRunNumber;
Expand Down
1 change: 0 additions & 1 deletion UserTools/Factory/Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ if (tool=="ProcessedLAPPDFilter") ret=new ProcessedLAPPDFilter;
if (tool=="BeamQuality") ret=new BeamQuality;
if (tool=="FitRWMWaveform") ret=new FitRWMWaveform;
if (tool=="LAPPDLoadTXT") ret=new LAPPDLoadTXT;
if (tool=="LAPPDBSCharging") ret=new LAPPDBSCharging;
if (tool=="MuonFitter") ret=new MuonFitter;
if (tool=="BackTracker") ret=new BackTracker;
if (tool=="PrintDQ") ret=new PrintDQ;
Expand Down
28 changes: 0 additions & 28 deletions UserTools/LAPPDBSCharging/LAPPDBSCharging.cpp

This file was deleted.

39 changes: 0 additions & 39 deletions UserTools/LAPPDBSCharging/LAPPDBSCharging.h

This file was deleted.

20 changes: 0 additions & 20 deletions UserTools/LAPPDBSCharging/README.md

This file was deleted.

2 changes: 2 additions & 0 deletions UserTools/LAPPDTimeAlignment/LAPPDTimeAlignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ double LAPPDTimeAlignment::Tfit(std::vector<double> *wf)
}
}
firstcross = false;
delete edge;
}
}
else
Expand Down Expand Up @@ -364,6 +365,7 @@ double LAPPDTimeAlignment::Tfit(std::vector<double> *wf)
*/

firstcross = false;
delete edge;
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions UserTools/LAPPDTreeMaker/LAPPDTreeMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ bool LAPPDTreeMaker::Initialise(std::string configfile, DataModel &data)
fGroupedTrigger->Branch("gTrigType", &groupedTriggerType, "gTrigType/I");
fGroupedTrigger->Branch("gTrigNum", &TriggerGroupNumInThisEvent, "gTrigNum/I");

TriggerWordMap = new std::map<uint64_t, std::vector<uint32_t>>;
m_data->Stores["ANNIEEvent"]->Header->Get("AnnieGeometry", _geom);
EventNumber = 0;

Expand Down Expand Up @@ -369,7 +368,10 @@ bool LAPPDTreeMaker::Finalise()
fTimeStamp->Write();
fTrigger->Write();
fGroupedTrigger->Write();

file->Close();
delete file;

return true;
}

Expand Down Expand Up @@ -1090,4 +1092,4 @@ void LAPPDTreeMaker::LoadLAPPDMapInfo()
{
cout << "LAPPDTreeMaker::LoadLAPPDMapInfo, no LAPPDDataMap found" << endl;
}
}
}
Loading
Loading