107 if(trks->empty())
return;
109 const unsigned int trkMax = trks->size();
111 for(
unsigned int trkIdx = 0; trkIdx < trkMax; ++trkIdx){
117 std::vector<geo::OfflineChan> xhits, yhits;
123 for(
unsigned int n = 0;
n < xhits.size(); ++
n){
124 const unsigned int plane = xhits[
n].Plane();
125 const unsigned int cell = xhits[
n].Cell();
126 if(hmap.CellExists(plane, cell)){
127 fHits->Fill(plane, cell);
130 fMiss->Fill(plane, cell);
135 for(
unsigned int n = 0;
n < yhits.size(); ++
n){
136 const unsigned int plane = yhits[
n].Plane();
137 const unsigned int cell = yhits[
n].Cell();
138 if(hmap.CellExists(plane, cell)){
139 fHits->Fill(plane, cell);
142 fMiss->Fill(plane, cell);
148 std::map<int, int> minsXY, maxsXY;
150 std::set<geo::OfflineChan> belows, aboves;
152 std::map<int, int> minsZ[2], maxsZ[2];
154 std::set<geo::OfflineChan> lefts, rights;
156 for(
unsigned int chitIdx = 0; chitIdx < track->
NCell(); ++chitIdx){
163 if(minsXY.find(plane) == minsXY.end() || cell < minsXY[
plane])
164 minsXY[plane] = cell;
165 if(cell > maxsXY[plane]) maxsXY[
plane] =
cell;
167 if(minsZ[view].find(cell) == minsZ[
view].end() || plane < minsZ[
view][
cell])
168 minsZ[view][cell] = plane;
180 for(std::map<int, int>::iterator
it = minsXY.begin();
it != minsXY.end(); ++
it){
182 const int from =
it->second;
183 const int to = maxsXY[
plane];
187 if(hmap.CellExists(plane,
cell))
195 for(std::map<int, int>::iterator
it = minsZ[
view].begin();
it != minsZ[
view].end(); ++
it){
196 const int cell =
it->first;
197 const int from =
it->second;
200 if(to == from)
continue;
205 if(hmap.CellExists(plane, cell))
215 for(std::set<geo::OfflineChan>::iterator
it = belows.begin();
it != belows.end(); ++
it){
217 const int cell =
it->Cell();
221 if(hmap.CellExists(plane, cell))
227 for(std::set<geo::OfflineChan>::iterator
it = lefts.begin();
it != lefts.end(); ++
it){
229 const int cell =
it->Cell();
233 if(hmap.CellExists(plane, cell))
252 for(
unsigned int p = 0;
p < geom->
NPlanes(); ++
p){
263 TH2F*
tot = tfs->
make<TH2F>(*fHits);
267 TH2F* totXYLoose = tfs->
make<TH2F>(*fHitsXYLoose);
268 totXYLoose->SetName(
"totXYLoose");
271 TH2F* totXYTight = tfs->
make<TH2F>(*fHitsXYTight);
272 totXYTight->SetName(
"totXYTight");
275 TH2F* totZLoose = tfs->
make<TH2F>(*fHitsZLoose);
276 totZLoose->SetName(
"totZLoose");
279 TH2F* totZTight = tfs->
make<TH2F>(*fHitsZTight);
280 totZTight->SetName(
"totZTight");
283 TH2F*
frac = tfs->
make<TH2F>(*fMiss);
284 frac->SetName(
"frac");
287 TH2F* fracXYLoose = tfs->
make<TH2F>(*fMissXYLoose);
288 fracXYLoose->SetName(
"fracXYLoose");
289 fracXYLoose->Divide(totXYLoose);
291 TH2F* fracXYTight = tfs->
make<TH2F>(*fMissXYTight);
292 fracXYTight->SetName(
"fracXYTight");
293 fracXYTight->Divide(totXYTight);
295 TH2F* fracZLoose = tfs->
make<TH2F>(*fMissZLoose);
296 fracZLoose->SetName(
"fracZLoose");
297 fracZLoose->Divide(totZLoose);
299 TH2F* fracZTight = tfs->
make<TH2F>(*fMissZTight);
300 fracZTight->SetName(
"fracZTight");
301 fracZTight->Divide(totZTight);
303 TH1F*
proj = tfs->
make<TH1F>(
"proj",
"", 101, 0, 1.01);
304 TH1F* projXYLoose = tfs->
make<TH1F>(
"projXYLoose",
"", 101, 0, 1.01);
305 TH1F* projXYTight = tfs->
make<TH1F>(
"projXYTight",
"", 101, 0, 1.01);
306 TH1F* projZLoose = tfs->
make<TH1F>(
"projZLoose",
"", 101, 0, 1.01);
307 TH1F* projZTight = tfs->
make<TH1F>(
"projZTight",
"", 101, 0, 1.01);
311 const int X = frac->GetNbinsX()+1;
312 const int Y = frac->GetNbinsY()+1;
313 for(
int x = 1;
x <
X; ++
x){
314 for(
int y = 1;
y <
Y; ++
y){
315 const bool isBad = hKnown->GetBinContent(
x,
y);
318 frac->SetBinContent(
x,
y, 0);
319 fracXYLoose->SetBinContent(
x,
y, 0);
320 fracXYTight->SetBinContent(
x,
y, 0);
321 fracZLoose->SetBinContent(
x,
y, 0);
322 fracZTight->SetBinContent(
x,
y, 0);
326 const double fr = frac->GetBinContent(
x,
y);
327 if(tot->GetBinContent(
x,
y)) proj->Fill(fr);
329 const double frLoXY = fracXYLoose->GetBinContent(
x,
y);
330 if(totXYLoose->GetBinContent(
x,
y)) projXYLoose->Fill(frLoXY);
332 const double frTiXY = fracXYTight->GetBinContent(
x,
y);
333 if(totXYTight->GetBinContent(
x,
y)) projXYTight->Fill(frTiXY);
335 const double frLoZ = fracZLoose->GetBinContent(
x,
y);
336 if(totZLoose->GetBinContent(
x,
y)) projZLoose->Fill(frLoZ);
338 const double frTiZ = fracZTight->GetBinContent(
x,
y);
339 if(totZTight->GetBinContent(
x,
y)) projZTight->Fill(frTiZ);
virtual void analyze(const art::Event &evt)
T max(const caf::Proxy< T > &a, T b)
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
virtual void reconfigure(const fhicl::ParameterSet &pset)
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
unsigned short Plane() const
unsigned int Ncells() const
Number of cells in this plane.
const PlaneGeo * Plane(unsigned int i) const
DEFINE_ART_MODULE(TestTMapFile)
virtual TVector3 Start() const
CosmicEff(const fhicl::ParameterSet &pset)
void CountCellsOnLineFast(double x1, double y1, double z1, double x2, double y2, double z2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
Make list of cells in each view traversed by a line segment.
Provides efficient lookup of CellHits by plane and cell number.
unsigned short Cell() const
T get(std::string const &key) const
double frac(double x)
Fractional part.
EDAnalyzer(Table< Config > const &config)
unsigned int NYCell() const
Number of cells in the y-view.
Calculate efficiency for cosmic rays to identify bad channels.
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
const unsigned int NextPlaneInView(unsigned int p, int d=+1) const
unsigned int NXCell() const
Number of cells in the x-view.
Interface to the run-by-run list of bad channels.
virtual void beginRun(const art::Run &run)
unsigned int NPlanes() const
TVector3 Stop() const
Position of the final trajectory point.
bool IsBad(int plane, int cell)
Simple object representing a (plane, cell) pair.
Encapsulate the geometry of one entire detector (near, far, ndos)