Skip to content

Commit

Permalink
Merge pull request #319 from SBNSoftware/develop
Browse files Browse the repository at this point in the history
Weekly Release
  • Loading branch information
SFBayLaser authored Jan 6, 2022
2 parents 768790e + dff4d47 commit 0d40ff0
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 32 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

cmake_minimum_required(VERSION 3.19 FATAL_ERROR)

project(icaruscode VERSION 09.40.00 LANGUAGES CXX)
project(icaruscode VERSION 09.41.00 LANGUAGES CXX)

message(STATUS
"\n-- ============================================================================="
Expand Down
98 changes: 80 additions & 18 deletions icaruscode/Analysis/AnalysisTree_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2152,25 +2152,87 @@ void icarus::AnalysisTree::analyze(const art::Event& evt)
// find particle ID info
art::FindMany<anab::ParticleID> fmpid(trackListHandle[iTracker], evt, fParticleIDModuleLabel[iTracker]);
if(fmpid.isValid()) {
std::vector<const anab::ParticleID*> pids = fmpid.at(iTrk);
if(pids.size() > 1) {
mf::LogError("AnalysisTree:limits")
<< "the " << fTrackModuleLabel[iTracker] << " track #" << iTrk
<< " has " << pids.size()
<< " set of ParticleID variables. Only one stored in the tree";
}
for (size_t ipid = 0; ipid < pids.size(); ++ipid){
if (!pids[ipid]->PlaneID().isValid) continue;
int planenum = pids[ipid]->PlaneID().Plane;
if (planenum<0||planenum>2) continue;
TrackerData.trkpidpdg[iTrk][planenum] = pids[ipid]->Pdg();
TrackerData.trkpidchi[iTrk][planenum] = pids[ipid]->MinChi2();
TrackerData.trkpidchipr[iTrk][planenum] = pids[ipid]->Chi2Proton();
TrackerData.trkpidchika[iTrk][planenum] = pids[ipid]->Chi2Kaon();
TrackerData.trkpidchipi[iTrk][planenum] = pids[ipid]->Chi2Pion();
TrackerData.trkpidchimu[iTrk][planenum] = pids[ipid]->Chi2Muon();
TrackerData.trkpidpida[iTrk][planenum] = pids[ipid]->PIDA();
std::vector<const anab::ParticleID*> pids = fmpid.at(iTrk);
if (pids.size() == 0){
mf::LogError("AnalysisTree:limits")
<< "No track-PID association found for " << fTrackModuleLabel[iTracker]
<< " track " << iTrk << ". Not saving particleID information.";
}
// Set dummy values
double pidpdg[3] = {0,0,0};
double pidchi[3] = {0.,0.,0.};
for(size_t planenum=0; planenum<3; ++planenum) {
TrackerData.trkpidchimu[iTrk][planenum] = 0.;
TrackerData.trkpidchipi[iTrk][planenum] = 0.;
TrackerData.trkpidchika[iTrk][planenum] = 0.;
TrackerData.trkpidchipr[iTrk][planenum] = 0.;
TrackerData.trkpidpida[iTrk][planenum] = 0.;
}
for (size_t ipid=0; ipid<pids.size(); ipid++){
std::vector<anab::sParticleIDAlgScores> AlgScoresVec = pids[ipid]->ParticleIDAlgScores();

// Loop though AlgScoresVec and find the variables we want
for (size_t i_algscore=0; i_algscore<AlgScoresVec.size(); i_algscore++){
anab::sParticleIDAlgScores AlgScore = AlgScoresVec.at(i_algscore);

/*std::cout << "\n ParticleIDAlg " << AlgScore.fAlgName
<< "\n -- Variable type: " << AlgScore.fVariableType
<< "\n -- Track direction: " << AlgScore.fTrackDir
<< "\n -- Assuming PDG: " << AlgScore.fAssumedPdg
<< "\n -- Number of degrees of freedom: " << AlgScore.fNdf
<< "\n -- Value: " << AlgScore.fValue
<< "\n -- Using planeMask: " << AlgScore.fPlaneMask << std::endl;*/

if (AlgScore.fPlaneMask.none() || AlgScore.fPlaneMask.count() > 1) continue;
int planenum = -1;
if (AlgScore.fPlaneMask.test(0)) planenum = 0;
if (AlgScore.fPlaneMask.test(1)) planenum = 1;
if (AlgScore.fPlaneMask.test(2)) planenum = 2;
if (planenum<0 || planenum>2) continue;

if (AlgScore.fAlgName == "Chi2"){
if (TMath::Abs(AlgScore.fAssumedPdg) == 13){ // chi2mu
TrackerData.trkpidchimu[iTrk][planenum] = AlgScore.fValue;
if (AlgScore.fValue<pidchi[planenum] || (pidchi[planenum] == 0. && AlgScore.fValue>0.)){
pidchi[planenum] = AlgScore.fValue;
pidpdg[planenum] = TMath::Abs(AlgScore.fAssumedPdg);
}
}
else if (TMath::Abs(AlgScore.fAssumedPdg) == 2212){ // chi2pr
TrackerData.trkpidchipr[iTrk][planenum] = AlgScore.fValue;
if (AlgScore.fValue<pidchi[planenum] || (pidchi[planenum] == 0. && AlgScore.fValue>0.)){
pidchi[planenum] = AlgScore.fValue;
pidpdg[planenum] = TMath::Abs(AlgScore.fAssumedPdg);
}
}
else if (TMath::Abs(AlgScore.fAssumedPdg) == 211){ // chi2pi
TrackerData.trkpidchipi[iTrk][planenum] = AlgScore.fValue;
if (AlgScore.fValue<pidchi[planenum] || (pidchi[planenum] == 0. && AlgScore.fValue>0.)){
pidchi[planenum] = AlgScore.fValue;
pidpdg[planenum] = TMath::Abs(AlgScore.fAssumedPdg);
}
}
else if (TMath::Abs(AlgScore.fAssumedPdg) == 321){ // chi2ka
TrackerData.trkpidchika[iTrk][planenum] = AlgScore.fValue;
if (AlgScore.fValue<pidchi[planenum] || (pidchi[planenum] == 0. && AlgScore.fValue>0.)){
pidchi[planenum] = AlgScore.fValue;
pidpdg[planenum] = TMath::Abs(AlgScore.fAssumedPdg);
}
}

}
else if (AlgScore.fVariableType==anab::kPIDA){
TrackerData.trkpidpida[iTrk][planenum] = AlgScore.fValue;
}

} // end loop though AlgScoresVec
} // end loop over pid[ipid]

// Finally, set min chi2
for (size_t planenum=0; planenum<3; planenum++){
TrackerData.trkpidchi[iTrk][planenum] = pidchi[planenum];
TrackerData.trkpidpdg[iTrk][planenum] = pidpdg[planenum];
}
} // fmpid.isValid()


Expand Down
18 changes: 9 additions & 9 deletions icaruscode/TPC/Simulation/SpaceCharge/SpaceChargeICARUS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ geo::Vector_t spacecharge::SpaceChargeICARUS::GetPosOffsets(geo::Point_t const&
//in larsim, this is how the offsets are used in DriftElectronstoPlane_module
// DriftDistance += -1.0 * thePosOffsets[0]
// thus need to apply correction to TPCs "left" of cryostat (tpc_corr)
// cathode spans x=220.14 and x=220.29 in pos cryostat
// cathode spans x=210.14 and x=210.29 in pos cryostat
if(xx>0){
cryo_corr=1.0;
if(xx<220.14){
if(xx<210.14){
tpc_corr=-1.0;
}
}else{
cryo_corr=-1.0;
if(xx<-220.29){
if(xx<-210.29){
tpc_corr=-1.0;
}
}
Expand Down Expand Up @@ -186,11 +186,11 @@ geo::Vector_t spacecharge::SpaceChargeICARUS::GetPosOffsets(geo::Point_t const&
//hard code in the cathode faces (got from dump_icarus_geometry.fcl)
//
//Gray Putnam: update this check to the split-wire Geometry
if (x_is_pos && (tpcid == 0 || tpcid == 1) && xx > 220.14 ) { xx = 220.14; }
if (x_is_pos && (tpcid == 2 || tpcid == 3) && xx < 220.29 ) { xx = 220.29; }
if (x_is_pos && (tpcid == 0 || tpcid == 1) && xx > 210.14 ) { xx = 210.14; }
if (x_is_pos && (tpcid == 2 || tpcid == 3) && xx < 210.29 ) { xx = 210.29; }

if (!x_is_pos && (tpcid == 2 || tpcid == 3) && xx > 220.14 ) { xx = 220.14; }
if (!x_is_pos && (tpcid == 0 || tpcid == 1) && xx < 220.29 ) { xx = 220.29; }
if (!x_is_pos && (tpcid == 2 || tpcid == 3) && xx > 210.14 ) { xx = 210.14; }
if (!x_is_pos && (tpcid == 0 || tpcid == 1) && xx < 210.29 ) { xx = 210.29; }

double offset_x=0., offset_y=0., offset_z=0.;
offset_x = corr*SCEhistograms.at(3)->Interpolate(xx,yy,zz);
Expand Down Expand Up @@ -234,8 +234,8 @@ geo::Vector_t spacecharge::SpaceChargeICARUS::GetEfieldOffsets(geo::Point_t cons
void spacecharge::SpaceChargeICARUS::fixCoords(double* xx, double* yy, double* zz) const{
//handle the edge cases by projecting SCE corrections onto boundaries
*xx = abs(*xx);
if(*xx<71.94){*xx=71.94;}
if(*xx>368.489){*xx=368.489;}
if(*xx<61.94){*xx=61.94;}
if(*xx>358.489){*xx=358.489;}
if(*yy<-181.86){*yy=-181.86;}
if(*yy>134.96){*yy=134.96;}
if(*zz<-894.951){*zz=-894.951;}
Expand Down
8 changes: 4 additions & 4 deletions ups/product_deps
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# The *parent* line must the first non-commented line and defines this product and version
# The version must be of the form vxx_yy_zz (e.g. v01_02_03)
parent icaruscode v09_40_00
parent icaruscode v09_41_00

defaultqual e20

Expand Down Expand Up @@ -37,11 +37,11 @@ table_fragment_end
# Add the dependent product and version

product version
sbncode v09_40_00
icarusalg v09_40_00
sbncode v09_41_00
icarusalg v09_41_00
icarusutil v09_37_01
icarus_signal_processing v09_37_01
icarus_data v09_37_01_02
icarus_data v09_41_00
fftw v3_3_9
libwda v2_29_1

Expand Down

0 comments on commit 0d40ff0

Please sign in to comment.