Skip to content

Commit

Permalink
Update to compile with WCSim v1.12.16
Browse files Browse the repository at this point in the history
  • Loading branch information
kmtsui committed Oct 2, 2024
1 parent ecae9f1 commit 03d88eb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ The library provides C++ classes that manage three tasks:
Simple runtime procedures. First set up your ROOT and WCSIM:
```
source your_thisroot.sh
export WCSIMDIR=your_WCSIM_installation
```
If `libWCSimRoot.so` is not directly under `WCSIMDIR`, export to `WCSIMROOTDIR`.
```
export WCSIMROOTDIR=your_libWCSimRoot.so_installation
source your_this_wcsim.sh # or just export WCSIM_BUILD_DIR
```
Then set up the MDT environment.
```
Expand All @@ -32,7 +28,7 @@ cd $MDTROOT/app/utilities/WCRootData; make clean; make all
cd $MDTROOT/app/application; make clean; make all
cd $MDTROOT
# edit variables properly in run_test_mdt4wcte.sh
bash run_test_mdt4iwcd.sh
bash run_test_mdt4wcte.sh
```

## IWCD usage
Expand Down
4 changes: 2 additions & 2 deletions app/application/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ CXX=g++
LD=g++

CXXFLAGS += -Wall -std=c++11 -g $(shell root-config --cflags)\
-I$(WCSIMDIR)/include\
-I$(WCSIM_BUILD_DIR)/include/WCSim\
-I${MDTROOT}/cpp/include\
-I${WCRDROOT}/include

LDFLAGS += $(shell root-config --ldflags) $(shell root-config --libs) -lTreePlayer\
-L$(WCSIMROOTDIR) -lWCSimRoot\
-L$(WCSIM_BUILD_DIR)/lib -lWCSimRoot\
-L${MDTROOT}/cpp -lMDT\
-L${WCRDROOT} -lWCRData

Expand Down
4 changes: 2 additions & 2 deletions app/utilities/WCRootData/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
CXX=g++
LD=g++

CXXFLAGS += -Wall -O2 -std=c++11 -g -fPIC -I./include $(shell root-config --cflags) -I$(WCSIMDIR)/include -I${MDTROOT}/cpp/include
CXXFLAGS += -Wall -O2 -std=c++11 -g -fPIC -I./include $(shell root-config --cflags) -I$(WCSIM_BUILD_DIR)/include/WCSim -I${MDTROOT}/cpp/include
#LDFLAGS += -shared $(shell root-config --ldflags) $(shell root-config --libs) -lTreePlayer -lMinuit2 -L$(WCSIMDIR) -lWCSimRoot -L${MDTROOT}/cpp -lMDT
LDFLAGS += -shared $(shell root-config --ldflags) $(shell root-config --libs) -L$(WCSIMROOTDIR) -lWCSimRoot -L${MDTROOT}/cpp -lMDT
LDFLAGS += -shared $(shell root-config --ldflags) $(shell root-config --libs) -L$(WCSIM_BUILD_DIR)/lib -lWCSimRoot -L${MDTROOT}/cpp -lMDT

TARGET=libWCRData.so

Expand Down
10 changes: 8 additions & 2 deletions app/utilities/WCRootData/src/WCRootData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void WCRootData::AddTrueHitsToMDT(HitTubeCollection *hc, PMTResponse *pr, float

th->SetStartTime(aHitTime->GetPhotonStartTime()+intTime);
for(int k=0; k<3; k++){ th->SetStartPosition(k, aHitTime->GetPhotonStartPos(k)); }
th->SetCreatorProcess((int)(aHitTime->GetPhotonCreatorProcess()));
if( !pr->ApplyDE(th) ){ continue; }

(&(*hc)[tubeID])->AddRawPE(th);
Expand Down Expand Up @@ -207,6 +208,7 @@ void WCRootData::AddDigiHits(HitTubeCollection *hc, TriggerInfo *ti, int eventID
std::vector<TVector3> photonEndPos;
std::vector<TVector3> photonStartDir;
std::vector<TVector3> photonEndDir;
std::vector<ProcessType_t> photonCreatorProcess;
for(hc->Begin(); !hc->IsEnd(); hc->Next())
{
// Get tube ID
Expand All @@ -227,6 +229,7 @@ void WCRootData::AddDigiHits(HitTubeCollection *hc, TriggerInfo *ti, int eventID
photonEndPos.push_back(TVector3(PEs[iPE]->GetPosition(0),PEs[iPE]->GetPosition(1),PEs[iPE]->GetPosition(2)));
photonStartDir.push_back(TVector3(PEs[iPE]->GetStartDirection(0),PEs[iPE]->GetStartDirection(1),PEs[iPE]->GetStartDirection(2)));
photonEndDir.push_back(TVector3(PEs[iPE]->GetDirection(0),PEs[iPE]->GetDirection(1),PEs[iPE]->GetDirection(2)));
photonCreatorProcess.push_back((ProcessType_t)(PEs[iPE]->GetCreatorProcess()));
}

anEvent->AddCherenkovHit(tubeID,
Expand All @@ -238,7 +241,8 @@ void WCRootData::AddDigiHits(HitTubeCollection *hc, TriggerInfo *ti, int eventID
photonStartPos,
photonEndPos,
photonStartDir,
photonEndDir);
photonEndDir,
photonCreatorProcess);

truetime.clear();
primaryParentID.clear();
Expand All @@ -247,6 +251,7 @@ void WCRootData::AddDigiHits(HitTubeCollection *hc, TriggerInfo *ti, int eventID
photonEndPos.clear();
photonStartDir.clear();
photonEndDir.clear();
photonCreatorProcess.clear();
}
const int nTriggers = ti->GetNumOfTrigger();
for(int iTrig=0; iTrig<nTriggers; iTrig++)
Expand Down Expand Up @@ -358,7 +363,7 @@ void WCRootData::AddTracks(const WCSimRootTrigger *aEvtIn, float offset_time, in
Int_t parenttype = aTrack->GetParenttype();
Int_t id = aTrack->GetId();
Int_t idPrnt = aTrack->GetParentId();

ProcessType_t creatorProcess = aTrack->GetCreatorProcess();

Double_t dir[3];
Double_t pdir[3];
Expand Down Expand Up @@ -393,6 +398,7 @@ void WCRootData::AddTracks(const WCSimRootTrigger *aEvtIn, float offset_time, in
stop,
start,
parenttype,
creatorProcess,
time,
id,
idPrnt,
Expand Down
3 changes: 3 additions & 0 deletions cpp/include/TrueHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ class TrueHit
float GetStartPosition(int i) const { return fStartPosition[i]; }
float GetStartDirection(int i) const { return fStartDirection[i]; }
int GetPosBin(int i) const { return fBin[i]; }
int GetCreatorProcess() const { return fCreatorProcess; }

void SetPosition(int i, float f) { fPosition[i] = f; }
void SetDirection(int i, float f) { fDirection[i] = f; }
void SetStartTime(float f) { fStartTime = f; }
void SetStartPosition(int i, float f) { fStartPosition[i] = f; }
void SetStartDirection(int i, float f) { fStartDirection[i] = f; }
void SetPosBin(int i, int b){ fBin[i] = b; }
void SetCreatorProcess(int i){ fCreatorProcess = i; }

private:
double fTime;
Expand All @@ -32,4 +34,5 @@ class TrueHit
float fStartDirection[3]; // Photon track initial direction
int fParentId;
int fBin[3];
int fCreatorProcess;
};
15 changes: 6 additions & 9 deletions envMDT.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [ -n "${MDTROOT}" ] ; then
drop_from_path "$LD_LIBRARY_PATH" "${old_mdtroot}/cpp"
LD_LIBRARY_PATH=$newpath

drop_from_path "$LD_LIBRARY_PATH" "${WCSIMROOTDIR}"
drop_from_path "$LD_LIBRARY_PATH" "${WCSIM_BUILD_DIR}/lib"
LD_LIBRARY_PATH=$newpath

drop_from_path "$LD_LIBRARY_PATH" "${WCRDROOT}"
Expand Down Expand Up @@ -59,18 +59,15 @@ else
fi

#--- WCSim
if [[ -z "${WCSIMDIR}" ]]; then
echo "WCSIMDIR not set. Exit!"
if [[ -z "${WCSIM_BUILD_DIR}" ]]; then
echo "WCSIM_BUILD_DIR not set. Exit!"
return
else
echo "Using WCSIM installed in $WCSIMDIR"
echo "Using WCSIM installed in $WCSIM_BUILD_DIR"
#export LD_LIBRARY_PATH=${WCSIMDIR}:$LD_LIBRARY_PATH

if [[ -z "${WCSIMROOTDIR}" ]]; then
WCSIMROOTDIR=$WCSIMDIR
fi
echo "Using libWCSimRoot.so installed in $WCSIMROOTDIR"
export LD_LIBRARY_PATH=${WCSIMROOTDIR}:$LD_LIBRARY_PATH
echo "Using libWCSimRoot.so installed in $WCSIM_BUILD_DIR/lib"
export LD_LIBRARY_PATH=${WCSIM_BUILD_DIR}/lib:$LD_LIBRARY_PATH
fi

#--- MDT's utility
Expand Down

0 comments on commit 03d88eb

Please sign in to comment.