Skip to content

Commit 6686745

Browse files
Fix bug for opdettype in light propagation time
1 parent b081746 commit 6686745

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.cc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ sbnd::LightPropagationCorrection::LightPropagationCorrection(fhicl::ParameterSet
3636
fOpDetX.push_back(pdCenter.X());
3737
fOpDetY.push_back(pdCenter.Y());
3838
fOpDetZ.push_back(pdCenter.Z());
39+
if(fPDSMap.pdType(opch)=="pmt_coated") fOpDetType.push_back(0);
40+
else if(fPDSMap.pdType(opch)=="pmt_uncoated") fOpDetType.push_back(1);
41+
else if(fPDSMap.pdType(opch)=="xarapuca_vuv") fOpDetType.push_back(2);
42+
else if(fPDSMap.pdType(opch)=="xarapuca_vis") fOpDetType.push_back(3);
43+
else fOpDetType.push_back(-1);
3944
}
4045

4146
auto const& tpc = art::ServiceHandle<geo::Geometry>()->TPC();
@@ -442,16 +447,18 @@ void sbnd::LightPropagationCorrection::GetPropagationTimeCorrectionPerChannel()
442447
double dy = fSpacePointY[sp] - _opDetY;
443448
double dz = fSpacePointZ[sp] - _opDetZ;
444449
double distanceToOpDet = std::sqrt(dx*dx + dy*dy + dz*dz);
445-
//double spToCathode = abs(fSpacePointX[sp]); // Distance from space point to cathode in mm
446-
//double cathodeToOpDet = std::sqrt(_opDetX*_opDetX + dy*dy + dz*dz); // Distance from cathode to OpDet in mm
447-
//float lightPropTimeVIS = spToCathode/fVGroupVUV + cathodeToOpDet/fVGroupVIS; // Speed
448-
449450
double cathodeToOpDet = std::sqrt(_opDetX*_opDetX + (dy/2)*(dy/2) + (dz/2)*(dz/2)); // Distance from cathode to OpDet in mm
450451
double spToCathode = std::sqrt( fSpacePointX[sp]*fSpacePointX[sp] + (dy/2)*(dy/2) + (dz/2)*(dz/2)); // Distance from space point to cathode in mm
451452

452453
float lightPropTimeVIS = spToCathode/fVGroupVUV + cathodeToOpDet/fVGroupVIS; // Speed
453454
float lightPropTimeVUV = distanceToOpDet / fVGroupVUV; // Speed of light in mm/ns for VUV
454-
float lightPropTime = std::min(lightPropTimeVIS, lightPropTimeVUV);
455+
float lightPropTime = 0;
456+
if(fOpDetType[opdet]==0)
457+
lightPropTime = std::min(lightPropTimeVIS, lightPropTimeVUV);
458+
else if(fOpDetType[opdet]==1)
459+
lightPropTime = lightPropTimeVIS;
460+
else
461+
throw art::Exception(art::errors::LogicError) << " OpDet Type " << fOpDetType[opdet] << " not supported ." << std::endl;
455462
float partPropTime = std::sqrt((fSpacePointX[sp]-fRecoVx)*(fSpacePointX[sp]-fRecoVx) + (fSpacePointY[sp]-fRecoVy)*(fSpacePointY[sp]-fRecoVy) + (fSpacePointZ[sp]-fRecoVz)*(fSpacePointZ[sp]-fRecoVz))/fSpeedOfLight;
456463
float PropTime = lightPropTime + partPropTime;
457464
if(PropTime < minPropTime) minPropTime = PropTime;

sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private:
145145

146146

147147
geo::WireReadoutGeom const& fWireReadout = art::ServiceHandle<geo::WireReadout>()->Get();
148-
148+
opdet::sbndPDMapAlg fPDSMap;
149149
//Flash finder manager
150150
::lightana::FlashFinderManager _mgr;
151151
::lightana::FlashFinderManager _mgr_tpc0;
@@ -162,6 +162,7 @@ private:
162162
std::vector<double> fOpDetX;
163163
std::vector<double> fOpDetY;
164164
std::vector<double> fOpDetZ;
165+
std::vector<int> fOpDetType;
165166

166167
std::string fReco2Label;
167168
std::string fOpT0FinderModuleLabel;

0 commit comments

Comments
 (0)