Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates to build with larsoft v06_26_02 #9

Open
wants to merge 14 commits into
base: v06_26_02
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ IF (NOT CETBUILDTOOLS_VERSION)
MESSAGE (FATAL_ERROR "ERROR: setup cetbuildtools to get the cmake modules")
ENDIF()

set(CMAKE_MODULE_PATH $ENV{ART_DIR}/Modules
set(CMAKE_MODULE_PATH $ENV{CANVAS_DIR}/Modules
$ENV{CETBUILDTOOLS_DIR}/Modules
${CMAKE_MODULE_PATH})

Expand All @@ -36,6 +36,7 @@ cet_set_compiler_flags(DIAGS CAUTIOUS
NO_UNDEFINED
ALLOW_DEPRECATIONS
EXTRA_FLAGS -pedantic -Wno-unused-local-typedefs
-std=c++14
)

cet_report_compiler_flags()
Expand Down Expand Up @@ -63,11 +64,10 @@ add_subdirectory(HitAna)
add_subdirectory(PowerAna)
add_subdirectory(fcl)
#add_subdirectory(ApplyField)
add_subdirectory(SECAna)
#add_subdirectory(SECAna)

# tests
add_subdirectory(test)

#add_subdirectory(test)

# ups - table and config files
add_subdirectory(ups)
Expand Down
14 changes: 7 additions & 7 deletions HitAna/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ simple_plugin(HitAna "module"
LaserObjects
larcore_Geometry_Geometry_service
larcore_Geometry
lardata_RecoBaseArt
lardata_RecoBase
lardata_RawData
${SIMULATIONBASE}
lardata_ArtDataHelper
lardataobj_RecoBase
lardataobj_RawData
nusimdata_SimulationBase
${ART_FRAMEWORK_CORE}
${ART_FRAMEWORK_PRINCIPAL}
${ART_FRAMEWORK_SERVICES_REGISTRY}
${ART_FRAMEWORK_SERVICES_OPTIONAL}
${ART_FRAMEWORK_SERVICES_OPTIONAL_TFILESERVICE_SERVICE}
${ART_PERSISTENCY_COMMON}
${ART_PERSISTENCY_PROVENANCE}
${ART_UTILITIES}
art_Persistency_Common canvas_Persistency_Common
art_Persistency_Provenance canvas_Persistency_Provenance
art_Utilities canvas_Utilities
${MF_MESSAGELOGGER}
${MF_UTILITIES}
${CETLIB}
Expand Down
19 changes: 8 additions & 11 deletions HitAna/HitAna_module.cc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,27 @@
// LArSoft includes
// #include "Simulation/SimChannel.h"
// #include "Simulation/LArG4Parameters.h"
#include "lardata/RawData/RawDigit.h"
#include "lardata/RawData/raw.h"
#include "lardata/RecoBaseArt/WireCreator.h"
#include "lardata/RecoBaseArt/HitCreator.h"
#include "lardata/RecoBase/Hit.h"
#include "lardata/RecoBase/Cluster.h"
#include "lardata/RecoBase/Wire.h"
#include "lardataobj/RawData/RawDigit.h"
#include "lardataobj/RawData/raw.h"
#include "lardata/ArtDataHelper/WireCreator.h"
#include "lardata/ArtDataHelper/HitCreator.h"
#include "lardataobj/RecoBase/Hit.h"
#include "lardataobj/RecoBase/Wire.h"
#include "larcore/Geometry/Geometry.h"
#include "larcore/Geometry/GeometryCore.h"
#include "larcore/SimpleTypesAndConstants/geo_types.h"
#include "larcoreobj/SimpleTypesAndConstants/geo_types.h"

// Framework includes
#include "art/Utilities/Exception.h"
#include "canvas/Utilities/Exception.h"
// #include "art/Framework/Core/EDAnalyzer.h"
#include "art/Framework/Core/EDAnalyzer.h"
#include "art/Framework/Principal/Event.h"
#include "art/Framework/Principal/Handle.h"
#include "art/Framework/Services/Registry/ServiceHandle.h"
#include "art/Framework/Services/Optional/TFileService.h"
#include "art/Framework/Core/ModuleMacros.h"
#include "art/Framework/Core/FindManyP.h"
#include "messagefacility/MessageLogger/MessageLogger.h"
#include "fhiclcpp/ParameterSet.h"
#include "art/Persistency/Common/Ptr.h"

// uBooNE includes
#include "lardata/Utilities/AssociationUtil.h"
Expand Down
16 changes: 8 additions & 8 deletions LaserCalibration/LaserCalibration_module.cc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#include "Simulation/LArG4Parameters.h"
#include "RawData/RawDigit.h"
#include "RawData/raw.h"
#include "RecoBaseArt/WireCreator.h"
#include "RecoBaseArt/HitCreator.h"
#include "lardata/ArtDataHelper/WireCreator.h"
#include "lardata/ArtDataHelper/HitCreator.h"
#include "RecoBase/Hit.h"
#include "RecoBase/Cluster.h"
#include "RecoBase/Wire.h"
Expand All @@ -42,7 +42,7 @@
#include "SimpleTypesAndConstants/geo_types.h"

// Framework includes
#include "art/Utilities/Exception.h"
#include "canvas/Utilities/Exception.h"
// #include "art/Framework/Core/EDAnalyzer.h"
#include "art/Framework/Core/EDProducer.h"
#include "art/Framework/Principal/Event.h"
Expand All @@ -58,10 +58,10 @@
// uBooNE includes
#include "Utilities/AssociationUtil.h"
// #include "uboone/Utilities/SignalShapingServiceMicroBooNE.h"
#include "CalibrationDBI/Interface/IDetPedestalService.h"
#include "CalibrationDBI/Interface/IDetPedestalProvider.h"
#include "CalibrationDBI/Interface/IChannelStatusService.h"
#include "CalibrationDBI/Interface/IChannelStatusProvider.h"
#include "CalibrationDBI/Interface/DetPedestalService.h"
#include "CalibrationDBI/Interface/DetPedestalProvider.h"
#include "CalibrationDBI/Interface/ChannelStatusService.h"
#include "CalibrationDBI/Interface/ChannelStatusProvider.h"

// ROOT includes. Note: To look up the properties of the ROOT classes,
// use the ROOT web site; e.g.,
Expand Down Expand Up @@ -429,7 +429,7 @@ namespace LaserCalibration {
unsigned UWireNumber = 1026;
unsigned VWireNumber = 196;

const lariov::IDetPedestalProvider& PedestalRetrievalAlg = art::ServiceHandle<lariov::IDetPedestalService>()->GetPedestalProvider();
const lariov::DetPedestalProvider& PedestalRetrievalAlg = art::ServiceHandle<lariov::DetPedestalService>()->GetPedestalProvider();
TH1F* SingleWire = new TH1F("You","Fuck",DigitVecHandle->at(UMap.at(UWireNumber)).Samples(),0,DigitVecHandle->at(UMap.at(UWireNumber)).Samples()-1);

std::vector<short> RawADC;
Expand Down
14 changes: 7 additions & 7 deletions LaserDataMerger/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ art_make( MODULE_LIBRARIES
LaserObjects
larcore_Geometry_Geometry_service
larcore_Geometry
lardata_RecoBaseArt
lardata_RecoBase
lardata_RawData
${SIMULATIONBASE}
lardata_ArtDataHelper
lardataobj_RecoBase
lardataobj_RawData
nusimdata_SimulationBase
${ART_FRAMEWORK_CORE}
${ART_FRAMEWORK_PRINCIPAL}
${ART_FRAMEWORK_SERVICES_REGISTRY}
${ART_FRAMEWORK_SERVICES_OPTIONAL}
${ART_FRAMEWORK_SERVICES_OPTIONAL_TFILESERVICE_SERVICE}
${ART_PERSISTENCY_COMMON}
${ART_PERSISTENCY_PROVENANCE}
${ART_UTILITIES}
art_Persistency_Common canvas_Persistency_Common
art_Persistency_Provenance canvas_Persistency_Provenance
art_Utilities canvas_Utilities
${MF_MESSAGELOGGER}
${MF_UTILITIES}
${CETLIB}
Expand Down
79 changes: 44 additions & 35 deletions LaserDataMerger/LaserDataMerger_module.cc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,24 @@
// on LArSoft headers too -- if they can't be loaded by their own, it's a bug!

// LArSoft includes
#include "lardata/RawData/RawDigit.h"
#include "lardata/RawData/raw.h"
#include "lardataobj/RawData/RawDigit.h"
#include "lardataobj/RawData/raw.h"
#include "larcore/Geometry/Geometry.h"
#include "larcore/Geometry/GeometryCore.h"

#include "larcore/SimpleTypesAndConstants/geo_types.h"
#include "larcoreobj/SimpleTypesAndConstants/geo_types.h"

// Framework includes
#include "art/Utilities/Exception.h"
#include "canvas/Utilities/Exception.h"
#include "art/Framework/Core/EDProducer.h"

#include "art/Framework/Principal/Event.h"
#include "art/Framework/Principal/Handle.h"
#include "art/Framework/Services/Registry/ServiceHandle.h"
#include "art/Framework/Services/Optional/TFileService.h"
#include "art/Framework/Core/ModuleMacros.h"
#include "art/Framework/Core/FindManyP.h"
#include "messagefacility/MessageLogger/MessageLogger.h"
#include "fhiclcpp/ParameterSet.h"
#include "art/Persistency/Common/Ptr.h"

// uBooNE includes
#include "lardata/Utilities/AssociationUtil.h"
Expand Down Expand Up @@ -99,13 +97,13 @@ class LaserDataMerger : public art::EDProducer
// The analysis routine, called once per event.
virtual void produce(art::Event& event) override;

float LinearRawToAngle(float Angles);
double LinearRawToAngle(double Angles);

float AttenuatorTickToPercentage(float Tick);

private:

bool DEBUG = false;
bool fDebug = false;

// All this goes into the root tree
TTree* fTimeAnalysis;
Expand All @@ -114,7 +112,7 @@ class LaserDataMerger : public art::EDProducer
unsigned int time_ms;

std::map< Long64_t, unsigned int > timemap; ///< Key value: index of event, corresponding index in laser data file
std::vector< std::vector<float> > laser_values; ///< line by line csv container
std::vector< std::vector<double> > laser_values; ///< line by line csv container

bool fReadTimeMap = false;
bool fGenerateTimeInfo = false;
Expand Down Expand Up @@ -220,17 +218,17 @@ void LaserDataMerger::beginRun(art::Run& run)
tree->GetEntry(idx);
timemap.insert(std::pair< Long64_t, unsigned int >(idx, map_root));

if (DEBUG)
{
std::cout << "idx: " << idx << " mapped to: " << timemap.at(idx) << std::endl;
}
//if (fDebug)
//{
// std::cout << "idx: " << idx << " mapped to: " << timemap.at(idx) << std::endl;
//}
}
delete InputFile;


// read the laser data file into a vector
std::string LaserFile = "Run-" + std::to_string(RunNumber) + ".txt";
fstream file(LaserFile, std::ios::in);
std::fstream file(LaserFile, std::ios::in);

if (file)
{
Expand All @@ -241,7 +239,7 @@ void LaserDataMerger::beginRun(art::Run& run)
while (getline(file, line))
{
Tokenizer info(line, sep); // tokenize the line of data
std::vector<float> values;
std::vector<double> values;

for (Tokenizer::iterator it = info.begin(); it != info.end(); ++it)
{
Expand All @@ -252,13 +250,13 @@ void LaserDataMerger::beginRun(art::Run& run)
// store array of values
laser_values.push_back(values);

if (DEBUG)
if (fDebug)
{
for (unsigned int idx = 0; idx < 15; idx++)
{
std::cout << laser_values.back().at(idx) << " ";
//std::cout << laser_values.back().at(idx) << " ";
}
std::cout << std::endl;
//std::cout << std::endl;
}

}
Expand Down Expand Up @@ -300,6 +298,7 @@ void LaserDataMerger::reconfigure(fhicl::ParameterSet const& parameterSet)
PositionLCS1.SetXYZ(fPositionLCS1[0], fPositionLCS1[1], fPositionLCS1[2]);
PositionLCS2.SetXYZ(fPositionLCS2[0], fPositionLCS2[1], fPositionLCS2[2]);

fDebug = parameterSet.get< bool >("Debug", false);

//fLaserSystemFile = parameterSet.get< bool >("LaserSystemFile");
}
Expand All @@ -314,7 +313,7 @@ void LaserDataMerger::produce(art::Event& event)
time_s = (unsigned int) event.time().timeHigh();
time_ms = (unsigned int) event.time().timeLow();

if (DEBUG)
if (fDebug)
{
std::cout << "Event ID: " << fEvent << std::endl;
std::cout << "Event Time (low): " << time_s << std::endl;
Expand All @@ -325,37 +324,48 @@ void LaserDataMerger::produce(art::Event& event)
}
else if (fReadTimeMap)
{
int laser_id = timemap.at(fEvent);
if (DEBUG) std::cout << "Event idx: " << fEvent << " Laser idx: " << laser_id << std::endl;
uint laser_id = timemap.at(fEvent);
if (fDebug) std::cout << "Event idx: " << fEvent << " Laser idx: " << laser_id << std::endl;

//auto LaserAA = std::make_unique<lasercal::LaserBeam>;
std::unique_ptr < lasercal::LaserBeam > LaserAA(new lasercal::LaserBeam());
// This is just for convinience, the TVector2 holds only the two angles

float Theta;
float Phi;

float Theta_raw = laser_values.at(laser_id).at(DataStructure::LinearPosition);
float Phi_raw = laser_values.at(laser_id).at(DataStructure::RotaryPosition);


double Theta;
double Phi;

double Theta_raw = laser_values.at(laser_id).at(DataStructure::LinearPosition);
double Phi_raw = laser_values.at(laser_id).at(DataStructure::RotaryPosition);

TVector3 Position;
TVector2 CalibratedAngles;

if (LCS_ID == 1){ // The downstream laser system (sitting at z = -20)
Theta = TMath::DegToRad() * (90 - LinearRawToAngle(Theta_raw - fDirCalLCS1[1]));
Theta = TMath::DegToRad() * (90.0 - LinearRawToAngle(Theta_raw - fDirCalLCS1[1]));
Phi = TMath::DegToRad() * Phi_raw - fDirCalLCS1[0];
Position = PositionLCS1;
}
else if (LCS_ID == 2) { // The upstream laser system (sitting at z = 1020)
Theta = TMath::DegToRad() * (90 - LinearRawToAngle(Theta_raw - fDirCalLCS2[1]));
Phi = TMath::DegToRad() * (Phi_raw - fDirCalLCS2[0]);
Theta = TMath::DegToRad() * (90.0 - LinearRawToAngle( Theta_raw - fDirCalLCS2[1]));
Phi = - TMath::DegToRad() * (Phi_raw - fDirCalLCS2[0]);
Position = PositionLCS2;
}
else {
std::cerr << "Laser System not recognized " << std::endl;
}

if (fDebug){
time_s = (unsigned int) event.time().timeHigh();
time_ms = (unsigned int) event.time().timeLow();

std::cout << "Positions from entry: " << laser_id << std::endl;
std::cout << "rot: (raw / calib): " << Theta_raw << " / " << Theta << std::endl;
std::cout << "lin: (raw / calib): " << Phi_raw << " / " << Phi << std::endl;
std::cout << "Event Time (low): " << time_s << std::endl;
std::cout << "Event Time (hig): " << time_ms << std::endl;
}


//CalibratedAngles.Set(TMath::DegToRad() * 45, TMath::DegToRad() * 190);
lasercal::LaserBeam Laser(Position, Phi, Theta);
Laser.SetLaserID(LCS_ID);
Expand All @@ -364,7 +374,7 @@ void LaserDataMerger::produce(art::Event& event)
Laser.SetPower(AttenuatorTickToPercentage(laser_values.at(laser_id).at(DataStructure::AttenuatorPosition)));
Laser.SetTime(laser_values.at(laser_id).at(DataStructure::TriggerTimeSec),
laser_values.at(laser_id).at(DataStructure::TriggerTimeUsec));
if (DEBUG) Laser.Print();
if (fDebug) Laser.Print();


*LaserAA = Laser;
Expand All @@ -387,13 +397,12 @@ float LaserDataMerger::AttenuatorTickToPercentage(float Tick){
else return -999.;
}

float LaserDataMerger::LinearRawToAngle( float RawTicks ){
double LaserDataMerger::LinearRawToAngle( double RawTicks ){

float linear2angle = 0.3499; ///< conversion constant of linear encoder to angle (mm/deg)
float TickLength = 0.00001; ///< Tick length in mm
//float err_linear2angle = 0.0002; ///< error of conversion factor

return RawTicks * TickLength / linear2angle;;
return RawTicks * TickLength / linear2angle;
}

DEFINE_ART_MODULE(LaserDataMerger)
Expand Down
Empty file modified LaserDataMerger/TimeMapProducer.fcl
100644 → 100755
Empty file.
Loading