43 Comment(
"Label of track reconstruction module (all tracks or stopping seleciton)")
47 Comment(
"Label of PCHitsList module (pclist or pcliststop)")
50 Name(
"WhichHitTrees"),
51 Comment(
"Which Hit Trees to make. All: \"tricell, trajectory, cellhit\"")
83 void endJob()
override;
88 void AddEventBranches(TTree *
t);
89 void ResetEventBranches();
99 void AddTrackBranches(TTree *
t);
100 void ResetTrackBranches();
115 void ResetHitBranches();
148 bool is_trajectory,
bool is_tricell,
149 bool is_avg,
bool is_z,
152 bool is_trajectory,
bool is_tricell,
153 bool is_avg,
bool is_z,
170 float &
x,
float &
y,
float &
z );
172 float &
x,
float &
y,
float &
z );
213 if( !FindTricellHits.isValid() ){
214 mf::LogInfo(
"CalibAna") <<
"No pathQualXY hits.";
return; }
215 if( !FindTrajHits.isValid() ){
216 mf::LogInfo(
"CalibAna") <<
"No pathQualTraj hits.";
return; }
217 if( !FindAvgHits.isValid() ){
218 mf::LogInfo(
"CalibAna") <<
"No pathQualAvg hits.";
return; }
219 if( !FindZHits.isValid() ){
220 mf::LogInfo(
"CalibAna") <<
"No pathQualZ hits.";
return; }
223 for(
unsigned int i=0;
i<tracks->size(); ++
i ){
238 std::vector<art::Ptr<caldp::PCHit> > trihits = FindTricellHits.at(
i);
239 std::vector<art::Ptr<caldp::PCHit> > trajhits = FindTrajHits.at(
i);
240 std::vector<art::Ptr<caldp::PCHit> > avghits = FindAvgHits.at(
i);
241 std::vector<art::Ptr<caldp::PCHit> > zhits = FindZHits.at(
i);
269 for(
size_t c = 0;
c < trk.
NCell(); ++
c){
273 bool is_avg =
HitInList( cellhit, avghits );
275 bool is_traj =
HitInList( cellhit, trajhits );
276 bool is_tri =
HitInList( cellhit, trihits );
288 for(
size_t h = 0;
h < trihits.size(); ++
h){
292 bool is_avg =
HitInList( trihit, avghits );
294 bool is_traj =
HitInList( trihit, trajhits );
304 if(
fHitTree.count(
"trajectory")==1){
306 for(
size_t h = 0;
h < trajhits.size(); ++
h){
310 bool is_avg =
HitInList( trajhit, avghits );
312 bool is_tri =
HitInList( trajhit, trihits );
313 if( is_tri ) ntricell++;
322 if(
tt_dcosz > 0.95 && ntricell!=0 ){
323 std::cout <<
"^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^\n\n" <<
std::endl;
325 for(
size_t h = 0;
h < trajhits.size(); ++
h){
345 <<
"P:" << hit.
Plane() <<
std::right << std::setw(6) << std::setfill(
' ')
346 <<
"C:" << hit.
Cell() <<
std::right << std::setw(6) << std::setfill(
' ')
347 <<
"W:" << hit.
W() <<
std::right << std::setw(6) << std::setfill(
' ')
348 <<
"T:" << hit.
TNS() <<
std::right << std::setw(6) << std::setfill(
' ')
358 for(
size_t i = 0;
i <
list.size(); ++
i)
366 for(
size_t i = 0;
i <
list.size(); ++
i)
391 fEventTree = tfs->
make<TTree>(
"event_tree",
"tree of variables per art event");
394 fTrackTree = tfs->
make<TTree>(
"track_tree",
"tree of variables per track");
398 std::vector< std::string >
types = {
"tricell",
"trajectory",
"cellhit"};
399 for(
auto&
type: types){
403 (
"tree of variables per "+
type+
" hit").c_str());
414 bool is_trajectory,
bool is_tricell,
415 bool is_avg,
bool is_z,
447 if( is_tricell ) ntypes++;
448 if( is_avg ) ntypes++;
452 <<
"Tricell, Avg, and Z selections should be mutually exclusive, " 453 <<
"but this hit is: " 454 << (is_tricell ?
"Tricell, " :
"")
455 << (is_avg ?
"Avg, " :
"")
456 << (is_z ?
"Z. " :
".");
467 bool is_trajectory,
bool is_tricell,
468 bool is_avg,
bool is_z,
528 return calibrator->
GetPECorr(cellhit, pchit.
W());
540 float &
x,
float &
y,
float &
z ){
544 double cell_center[3];
561 float &
x,
float &
y,
float &
z ){
564 double cell_center[3];
605 TTree* FileTree = tfs->
make<TTree>(
"file_tree",
"tree of info per file");
606 FileTree->Branch(
"baserel", &baserel );
607 FileTree->Branch(
"testrel", &testrel );
608 FileTree->Branch(
"csvpath_atten", &csvpath_atten );
609 FileTree->Branch(
"csvpath_abs", &csvpath_abs );
610 FileTree->Branch(
"csvpath_timing", &csvpath_timing );
611 FileTree->Branch(
"csvpath_drift", &csvpath_drift );
612 FileTree->Branch(
"calibtag", &calibtag );
617 FileTree->Branch(
"UseAbsEpochs", &UseAbsEpochs );
618 FileTree->Branch(
"AbsEpochTag", &AbsEpochTag );
619 FileTree->Branch(
"TimingTag", &TimingTag );
620 FileTree->Branch(
"UseTimingEpochs", &UseTimingEpochs );
621 FileTree->Branch(
"TimingEpochTag", &TimingEpochTag );
622 FileTree->Branch(
"DriftCSV", &DriftCSV );
623 FileTree->Branch(
"UseDriftEpochs", &UseDriftEpochs );
624 FileTree->Branch(
"DriftEpochTag", &DriftEpochTag );
671 t->Branch(
"trk_pdg",&
tt_pdg);
704 t->Branch(
"w",&
ht_w);
709 t->Branch(
"pe",&
ht_pe);
int Pixel() const
Return pixel value.
void FillWithPCHit(caldp::PCHit const &pchit, bool is_trajectory, bool is_tricell, bool is_avg, bool is_z, float trk_len)
float TrueMeV() const
Return True energy (MeV) value.
Atom< bool > UseTimingEpochs
float TNS() const
Return uncorrected hit time.
SubRunNumber_t subRun() const
float FlightLen() const
Return path from start of track to current cell.
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
void GetCenter(double *xyz, double localz=0.0) const
void AddHitBranches(TTree *t, std::string type)
double GetPECorrToGeVScale(rb::CellHit const &cellhit)
void SetTNS(float tns, bool good)
Atom< std::string > DriftEpochTag
int32_t TDC() const
The time of the last baseline sample.
float TruePath() const
Return True Pathlength value.
void analyze(art::Event const &e) override
int APD() const
Return apd value.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
unsigned short Plane() const
const CellGeo * Cell(int icell) const
bool GoodTime() const
Return quality of timing fit for cell.
constexpr std::uint32_t timeHigh() const
Vertical planes which measure X.
int Cell() const
Return cell value.
void AddEventBranches(TTree *t)
Atom< std::string > TimingTag
A rb::Prong with full reconstructed trajectory.
const PlaneGeo * Plane(unsigned int i) const
Atom< std::string > AbsEpochTag
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
DEFINE_ART_MODULE(TestTMapFile)
virtual TVector3 Start() const
CalibAna(const Parameters ¶ms)
float GetPECorr(caldp::PCHit const &pchit)
float TrueW() const
Return True W value.
Horizontal planes which measure Y.
"Pre-calibration hit". Common input to calibration procedures
float Path() const
Return Path value.
void SetView(geo::View_t view)
void SetPlane(unsigned short plane)
float W() const
Return W value.
virtual double TotalLength() const
Length (cm) of all the track segments.
unsigned int getBrightnessIndex(unsigned int plane, unsigned int cell) const
unsigned short Cell() const
Track finder for cosmic rays.
float PoissonLambda() const
Return number of simulated photons at readout before fluctuations.
void SetCell(unsigned short cell)
void FillWithCellHit(art::Ptr< rb::CellHit > cellhit, bool is_trajectory, bool is_tricell, bool is_avg, bool is_z, float trk_len)
float PE() const
Return PE value.
float TruePE() const
Return True PE value.
float GetPECorrToMeV(caldp::PCHit const &pchit)
std::string getenv(std::string const &name)
Atom< std::string > PCHitsLabel
virtual TVector3 Dir() const
Unit vector describing prong direction.
Geometry information for a single readout plane.
void AddTrackBranches(TTree *t)
std::string GetDriftConstsCSVPath()
void ApproximateHitPos(caldp::PCHit const &hit, float &x, float &y, float &z)
void ResetTrackBranches()
std::string GetTimingConstsCSVPath()
int Plane() const
Return plane value.
geo::View_t View() const
Return view.
int Diblock() const
Return diblock value.
std::string GetAbsConstsCSVPath()
void PrintHit(caldp::PCHit const &hit)
Atom< bool > UseAbsEpochs
Atom< std::string > WhichHitTrees
void SetMC(bool isMC=true)
Histograms used by attenuation calibration.
EventNumber_t event() const
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
A rawdata::RawDigit with channel information decoded.
T * make(ARGS...args) const
int16_t ADC(uint32_t i) const
float ReadDist() const
Return distance to readout, with pigtail.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Atom< std::string > TimingEpochTag
std::map< std::string, TTree * > fHitTree
Atom< std::string > DriftCSV
std::string GetAttenCSVPath()
double GetPECorr(rb::CellHit const &cellhit, double w)
int DCM() const
Return dcm value.
TVector3 Stop() const
Position of the final trajectory point.
void ResetEventBranches()
Encapsulate the cell geometry.
CalibratorParams GetCalibratorParams()
bool HitInList(caldp::PCHit const &hit, std::vector< art::Ptr< caldp::PCHit > > list)
Atom< std::string > TrackLabel
Atom< bool > UseDriftEpochs
bool MatchHits(caldp::PCHit const &h1, caldp::PCHit const &h2)