28 #include "DAQChannelMap/DAQChannelMap.h" 32 #include "NovaDAQConventions/DAQConventions.h" 51 unsigned int DcmKey(
unsigned int dib,
unsigned int ldc) {
52 return dib*100+ldc; };
128 unsigned int ndcm = 12;
129 unsigned int ndb = 14;
153 plane=(geom->
Plane(*(planes.begin())));
156 tfs->
make<TH2F>(Form(
"HTrackEnd_%s_%d",viewName.c_str(),
cut),
157 Form(
"Track Endpoints, %s, %s",viewName.c_str(),cutname.c_str()),
171 tfs->
make<TH1F>(Form(
"HTrackPlanes%d",
cut),
172 Form(
"Track Extent (Planes), %s",cutname.c_str()),
177 tfs->
make<TH1F>(Form(
"HNCellTrk_%d",
cut),
178 Form(
"Track Number of Cells, %s",cutname.c_str()),
181 tfs->
make<TH1F>(Form(
"HNCellViewTrk_X_%d",
cut),
182 Form(
"Track Number of Cells, X, %s",cutname.c_str()),
185 tfs->
make<TH1F>(Form(
"HNCellViewTrk_Y_%d",
cut),
186 Form(
"Track Number of Cells, Y, %s",cutname.c_str()),
190 tfs->
make<TH1F>(Form(
"HTrkCellXMinusY_%d",
cut),
191 Form(
"Track Cell difference, X-Y view, %s",cutname.c_str()),
196 for (
unsigned int igrp=0; igrp<2; igrp++) {
197 std::string groupname(igrp==kAll ?
"(All Events)" :
"Event Group");
199 tfs->
make<TH2F>(Form(
"HTracksDCM_%d_%d",igrp,
cut),
200 Form(
"Tracks in DCM (ldcm vs. db), %s %s",groupname.c_str(),cutname.c_str()),
201 ndb,+.5,(
float)ndb+.5,ndcm,.5,(
float)ndcm+.5);
203 tfs->
make<TH2F>(Form(
"HTracksDCMHits_%d_%d",igrp,
cut),
204 Form(
"Track Hits in DCM (ldcm vs. db), %s %s",groupname.c_str(),cutname.c_str()),
205 ndb,+.5,(
float)ndb+.5,ndcm,.5,(
float)ndcm+.5);
208 tfs->
make<TH2F>(Form(
"HTracksOtherDCMs_%d_%d",igrp,
cut),
209 Form(
"Number of Other DCMs with Track Hits, vs. DCM (ldcm vs. db), %s %s",groupname.c_str(),cutname.c_str()),
210 ndb,+.5,(
float)ndb+.5,ndcm,.5,(
float)ndcm+.5);
213 tfs->
make<TH2F>(Form(
"HTracksOtherDCMHits_%d_%d",igrp,
cut),
214 Form(
"Number of Track Hits on Other DCMs, vs. DCM (ldcm vs. db), %s %s",groupname.c_str(),cutname.c_str()),
215 ndb,+.5,(
float)ndb+.5,ndcm,.5,(
float)ndcm+.5);
218 tfs->
make<TH2F>(Form(
"HTracksOtherDCMRatio_%d_%d",igrp,
cut),
219 Form(
"Ratio of Track Hits on Other DCMs vs. DCM (ldcm vs. db), %s %s",groupname.c_str(),cutname.c_str()),
220 ndb,+.5,(
float)ndb+.5,ndcm,.5,(
float)ndcm+.5);
237 std::map<unsigned int, std::map<unsigned int, float> >::iterator
239 std::map<unsigned int, std::map<unsigned int, float> >::iterator
243 float bgroup=(
float) iter->first;
244 float fgroup=(
float) end->first;
247 tfs->
make<TProfile>(
"HRatioOtherDCM_All",
248 "Ratio of Hits on other DCMs vs. event, All DCMs",
251 std::map<unsigned int, TProfile*> eventPlots;
256 float event=(
float) iter->first;
259 std::map<unsigned int, float> gmap=iter->second;
260 std::map<unsigned int, float>::iterator siter=gmap.begin();
261 for(; siter!=gmap.end(); siter++) {
262 unsigned int key=siter->first;
264 unsigned int ldc=
LDCM(key);
265 float ratio=siter->second;
267 if (eventPlots.find(key) == eventPlots.end() || !eventPlots[
key]) {
269 tfs->
make<TProfile>(Form(
"HRatioOtherDCM_%2.2d_%2.2d",dib,ldc),
270 Form(
"Ratio of Hits on other DCMs vs. event, %2.2d-%2.2d",dib,ldc),
273 eventPlots[
key]->Fill(event,ratio);
274 hratioall->Fill(event,ratio);
326 if (!tracks->size()) {
336 mf::LogError(
"CPLTWarn") <<
"\nFound Tracks but no CellHits!\n";
342 for(
unsigned int tr = 0;
tr < tracks->size();
tr++)
346 std::map<unsigned int, unsigned int> DCMsHit;
353 unsigned short cellx[2][2]={{9999,0},{9999,0}};
354 unsigned short planex[2][2]={{9999,0},{9999,0}};
357 for (
unsigned int ic=0; ic<track->
NCell(); ic++)
363 const unsigned int ldc = cmap->
Map()->
getDCM(chan);
364 DCMsHit[
DcmKey(dib,ldc)]++;
367 const unsigned int plannum = cmap->
Map()->
getPlane(logchan);
368 if (plannum!=cell->
Plane()) {
373 unsigned int cellnum=(
unsigned int) cell->
Cell();
378 if (plannum<planex[view][0]) {
379 cellx[
view][0]=cellnum;
380 planex[
view][0]=plannum;
382 if (plannum>planex[view][1]) {
383 cellx[
view][1]=cellnum;
384 planex[
view][1]=plannum;
391 std::map<unsigned int, unsigned int>::iterator iter=DCMsHit.begin();
392 for (; iter!=DCMsHit.end(); iter++) {
393 unsigned int dcmkey=iter->first;
394 float otherdcmhits=0;
396 std::map<unsigned int, unsigned int>::iterator oter=DCMsHit.begin();
397 for (; oter!=DCMsHit.end(); oter++) {
398 unsigned int otherdcmkey=oter->first;
399 if (otherdcmkey==dcmkey)
continue;
400 otherdcmhits+=(
float)oter->second;
404 float thisdcmhits=(
float) iter->second;
405 float ratioOtherToThis=otherdcmhits/thisdcmhits;
409 if (
cut==1&&!track_ok)
continue;
411 unsigned int dib=
DiBlock(dcmkey);
412 unsigned int ldc=
LDCM(dcmkey);
415 for (
unsigned int igrp=0; igrp<2; igrp++) {
422 for (
unsigned int iend=0; iend<2; iend++)
509 for (
unsigned int dib=1; dib<=(
unsigned int) hist->GetXaxis()->GetNbins(); dib++)
511 for (
unsigned int ldc=1; ldc<=(
unsigned int) hist->GetYaxis()->GetNbins(); ldc++)
514 std::map<unsigned int, std::map<unsigned int, float> >::iterator find=
518 std::map<unsigned int, float> amap=std::map<unsigned int, float> ();
522 hist->GetBinContent(dib,ldc);
TH2F * fHTracksDCMHits[kNumGroup][kNumLevel]
Number of hits per track on DCM.
TH1F * fHTrkCellXMinusY[kNumLevel]
difference in cells per view
const unsigned int fMinCellTrackView
track cuts
TH1F * fHNCellTrk[kNumLevel]
plots of raw digits
std::map< unsigned int, std::map< unsigned int, float > > fTracksOtherDCMRatio
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
unsigned int LDCM(unsigned int key)
const std::string fTrackLabel
module names
TH1F * fHNCellViewTrk[geo::kXorY][kNumLevel]
plots of raw digits
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
unsigned short Plane() const
enum dprf::TrackPlots::_cutlevel Cuts_t
Vertical planes which measure X.
unsigned int Ncells() const
Number of cells in this plane.
const daqchannelmap::DAQChannelMap * Map() const
TH2F * fHTracksOtherDCMHits[kNumGroup][kNumLevel]
Number of hits on other DCMs with hits on track.
const PlaneGeo * Plane(unsigned int i) const
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
def ratio(spec1, spec2, nbins, pot, binrange=(0, 1))
DEFINE_ART_MODULE(TestTMapFile)
lchan encodeLChan(int detId, plane_t plane, cell_t cell) const
TrackPlots(fhicl::ParameterSet const &p)
Horizontal planes which measure Y.
const std::string fRawDigitLabel
const unsigned int fMinPlaneTrack
std::map< unsigned int, ViewH > fHBookedChanCP
map of booked channels in cell-plane, vs group
unsigned short Cell() const
View_t View() const
Which coordinate does this plane measure.
uint32_t DaqChannel() const
TH2F * fHTrackEnd[geo::kXorY][kNumLevel]
(Cell,Plane) for endpoints
correl_yv Fill(-(dy[iP-1][iC-1]), hyv->GetBinContent(iP, iC))
Prototype Near Detector on the surface at FNAL.
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Geometry information for a single readout plane.
const std::string fCellHitLabel
Near Detector in the NuMI cavern.
const unsigned int fMinCellTrack
unsigned int DcmKey(unsigned int dib, unsigned int ldc)
unsigned int fCallNumber
keep track number of calls, for defining event groups
EDAnalyzer(Table< Config > const &config)
unsigned int DiBlock(unsigned int key)
TH2F * fHTracksDCM[kNumGroup][kNumLevel]
DCMs with hits on tracks.
void beginRun(const art::Run &run)
unsigned int NYCell() const
Number of cells in the y-view.
EventNumber_t event() const
bool TrackOK(art::Ptr< rb::Track >)
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
enum dprf::TrackPlots::_groups Groups_t
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
const unsigned int fEventGroup
Number of events per group.
TH2F * fHTracksOtherDCMRatio[kNumGroup][kNumLevel]
Ratio of hits on track on DCM to hits on track on all other DCMs.
const unsigned int fMinTrackHitDCM
minimum number of hits on a track in a DCM to use it for comparision to other DCMs ...
unsigned int NXCell() const
Number of cells in the x-view.
TH1F * fHExtentPlaneTrk[kNumLevel]
plots of raw digits
const std::set< unsigned int > & GetPlanesByView(View_t v=kXorY) const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
unsigned int ExtentPlane(geo::View_t view=geo::kXorY) const
plane_t getPlane(lchan logicalchan) const
Decode the plane number from an lchan.
TH2F * fHTracksOtherDCMs[kNumGroup][kNumLevel]
Number of other DCMs with hits on track.
assert(nhit_max >=nhit_nbins)
dcm_id_t getDCM(dchan daqchan) const
Decode the dcm ID from a dchan.
unsigned int NPlanes() const
void Normalize(unsigned int)
diblock_t getDiBlock(dchan daqchan) const
Decode the diblock ID from a dchan.
void FinishEventGroup(unsigned int)
Encapsulate the geometry of one entire detector (near, far, ndos)
virtual void analyze(art::Event const &)