25 #include "NovaDatabase/Table.h" 29 #include "Utilities/func/MathUtil.h" 31 static const double ns = 1.0E-9;
114 fNEvents = tfs->
make<TH1D>(
"fNEvents",
";;Number of events",2,0,2);
115 fTrackLength = tfs->
make<TH1D>(
"trackLength",
";Track Length (cm);" , 100, 0., 1000.);
116 fCosCosmic = tfs->
make<TH1D>(
"coscosmic",
";Cos #theta wrt zenith",1000,0.,1.);
117 fCosmicRate = tfs->
make<TH1D>(
"cosmicrate",
";Cosmic Rate (Hz)",1,0.,100000);
120 const TString viewStr = (
view ==
geo::kX) ?
"X" :
"Y";
121 fTNS[
view] = tfs->
make<TH1D>(
"HitTNS"+viewStr,
";Time (ns);hits", 70, -100000.0, 600000.);
154 if (trks->size()==0) {
155 mf::LogWarning(
"CosmicMetricsWarn") <<
"There are " << trks->size()
156 <<
" Tracks in this event, skip";
159 LOG_DEBUG(
"CosmicMetrics") <<
"There are " << trks->size() <<
" Tracks in this event";
161 const unsigned int trkMax = trks->size();
162 double cosCosmic = 0.;
166 for(
unsigned int trkIdx = 0; trkIdx < trkMax; ++trkIdx){
168 bool isgoodXZtrack =
false;
169 bool isgoodYZtrack =
false;
176 TVector3
dir(track->
Dir());
182 if (this->
IsEntering(start.X(),start.Y(),start.Z()) ==
false)
continue;
184 const unsigned int hitMax = track->
NCell();
185 const unsigned int hitX = track->
NXCell();
186 const unsigned int hitY = track->
NYCell();
192 double TNS[2] = {0.};
193 double TNStotal[2] = {0.};
194 double TNSaverage[2] = {0.};
205 const int vhitMax = track->
NCell(geoview);
207 for(
int hitIdx = 0; hitIdx < vhitMax; ++hitIdx){
220 isgoodXZtrack =
true;
223 isgoodYZtrack =
true;
227 if(isgoodXZtrack ==
true && isgoodYZtrack ==
true){
264 std::cout<<
"The livetime is " << fLivetime <<
"!\n";
265 std::cout<<
"The cosmic rate is therefore " << fCosmicrate <<
" Hz \n";
296 r->
Set(
"nevents", fNevents);
297 r->
Set(
"ntracks", fNTracks);
298 r->
Set(
"livetime", fLivetime);
299 r->
Set(
"cosmicrate", fCosmicrate);
static std::string GetName(int id)
bool Set(std::string cname, T value)
#define LOG_DEBUG(stream)
SubRunNumber_t subRun() const
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
std::string fTrackLabel
Where to find Tracks.
fvar< T > fabs(const fvar< T > &x)
TH1D * fNEvents
total number of events
bool IsEntering(double x, double y, double z)
yes/no is "track" entering within a buffer window
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Vertical planes which measure X.
std::string fCellHitsListLabel
Where to find CellHits.
TH1D * fTrackLength
length of track [cm]
unsigned int fMuonNhit
Required # hits on muon track.
DEFINE_ART_MODULE(TestTMapFile)
virtual TVector3 Start() const
CosmicMetrics(fhicl::ParameterSet const &pset)
Horizontal planes which measure Y.
bool SetValidityRange(std::string cname, T start, T end)
unsigned int fMuonNhitY
required in y view
uint8_t fTriggerMask_TriggerType
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
double fMaxTDC
Maximum TDC value to accept track.
unsigned int fMuonNhitX
required in x view
TH1D * fTNS[2]
distribution of XZ/YZ CellHit times in nano seconds
bool WriteToDB(bool commit=true)
use commit=false if just testing
std::string getenv(std::string const &name)
Commissioning files to look at the quality of our data.
T get(std::string const &key) const
unsigned int fNevents
total number of events counter
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
virtual TVector3 Dir() const
Unit vector describing prong direction.
double DetHalfHeight() const
EDAnalyzer(Table< Config > const &config)
static const double ns
Module that plots metrics from reconstructed cosmic ray data.
void AddRow(const Row *row)
bool SetDetector(std::string det)
unsigned int NYCell() const
Number of cells in the y-view.
TH1D * fCosmicRate
histogram holding single value for cosmic rate at end of job [Hz]
std::string fSoftwareRelease
Software release.
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
int fNTracks
total number of reconstructed tracks counter, using time cuts
std::string fRawDataLabel
Where to find RawData.
T * make(ARGS...args) const
double fTrkLengthCut
Minimum length of track to accept [cm].
double DetHalfWidth() const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
double pythag(double x, double y)
2D Euclidean distance
double fMinTDC
Minimum TDC value to accept track.
unsigned int NXCell() const
Number of cells in the x-view.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
TH1D * fCosCosmic
cosine theta of cosmic track with respect to zenith
double fDetEdgeBuffer
Detector edge buffer zone for entering cosmic ray track decision [cm].
assert(nhit_max >=nhit_nbins)
unsigned int fTriggerType
TVector3 Stop() const
Position of the final trajectory point.
void reconfigure(const fhicl::ParameterSet &pset)
void analyze(art::Event const &evt)
The analysis of CosmicTrack reconstructed tracks in roder to calculate cosmic ray muon rates...
int fSubRun
Subrun number.
Encapsulate the geometry of one entire detector (near, far, ndos)