#include <PmtHit.h>
Inheritance diagram for Anp::PmtHit:

Public Types | |
| typedef std::map< short, TH2 * > | PixelMap |
Public Member Functions | |
| PmtHit () | |
| virtual | ~PmtHit () |
| void | Plot (const PlaneHitColl &plane) |
| void | Config (const Registry ®) |
| void | Set (TDirectory *dir) |
| bool | Init (const Header &header) |
Private Member Functions | |
| TH2 * | GetPixel (PixelMap &pmap, short pixel, const std::string &name) |
| TH1 * | GetTH1 (const std::string &key, const std::string &name="") |
| TH2 * | GetTH2 (const std::string &key, const std::string &name="") |
| double | GetPixelXCoordinate (short pixel) const |
| double | GetPixelYCoordinate (short pixel) const |
Private Attributes | |
| TDirectory * | fDir |
| double | fSignalCut |
| bool | fValid |
| bool | fPlotPixel |
| Header | fHeader |
| TH1 * | fOtherP |
| TH1 * | fOtherN |
| TH1 * | fTrackP |
| TH1 * | fTrackN |
| TH1 * | fStripDiffAboveP |
| TH1 * | fStripDiffAboveN |
| TH1 * | fStripDiffBelowP |
| TH1 * | fStripDiffBelowN |
| TH1 * | fStripTrackP |
| TH1 * | fStripTrackN |
| TH1 * | fStripOtherP |
| TH1 * | fStripOtherN |
| TH1 * | fOtherNCountAbove |
| TH1 * | fOtherNCountBelow |
| TH1 * | fOtherOverTrack |
| TH1 * | fTimeAbove |
| TH1 * | fTimeBelow |
| TH2 * | f2dAboveP |
| TH2 * | f2dBelowP |
| TH2 * | f2dTrackN |
| TH2 * | f2dTrackP |
| TH2 * | f2dAboveN |
| TH2 * | f2dBelowN |
| PixelMap | fPixelN |
| PixelMap | fPixelP |
|
|
|
|
|
Definition at line 61 of file PmtHit.cxx. 00062 :fDir(0), 00063 fSignalCut(1.0), 00064 fValid(false), 00065 fPlotPixel(true) 00066 { 00067 }
|
|
|
Definition at line 70 of file PmtHit.cxx. 00071 {
00072 }
|
|
|
Definition at line 208 of file PmtHit.cxx. References fPlotPixel, fSignalCut, Registry::Get(), Registry::KeyExists(), Anp::Read(), and reg. 00209 {
00210 //
00211 // Configure self
00212 //
00213 reg.Get("PmtHitSignalCut", fSignalCut);
00214
00215 Anp::Read(reg, "PmtHitPlotPixel", fPlotPixel);
00216
00217 if(reg.KeyExists("PrintConfigPmt"))
00218 {
00219 cout << "PmtHit::Config" << endl
00220 << " SignalCut = " << fSignalCut << endl
00221 << " PlotPixel = " << fPlotPixel << endl;
00222 }
00223 }
|
|
||||||||||||||||
|
Definition at line 300 of file PmtHit.cxx. References abs(), fDir, fHeader, GetPixelXCoordinate(), GetPixelYCoordinate(), GetTH2(), Anp::Header::IsFar(), Anp::Header::IsNear(), and Anp::SetDir(). 00301 {
00302 PixelMap::iterator pit = pmap.find(pixel);
00303 if(pit == pmap.end())
00304 {
00305 string prefix;
00306 if (fHeader.IsNear()) prefix = "near";
00307 else if(fHeader.IsFar()) prefix = "far";
00308
00309 const short pixelX = static_cast<short>(GetPixelXCoordinate(pixel));
00310 const short pixelY = static_cast<short>(GetPixelYCoordinate(pixel));
00311
00312 stringstream pname;
00313 pname << name << "_pixel_" << setw(2) << setfill('0') << pixel << "_coord_"
00314 << setw(1) << setfill('0') << abs(pixelX) << "_and_"
00315 << setw(1) << setfill('0') << abs(pixelY);
00316
00317 TH2 *h = GetTH2(prefix + "_pmt_map", pname.str());
00318 if(h)
00319 {
00320 Anp::SetDir(h, Anp::GetDir("pixel", fDir));
00321 }
00322
00323 pit = pmap.insert(PixelMap::value_type(pixel, h)).first;
00324 }
00325
00326 return pit -> second;
00327 }
|
|
|
Definition at line 358 of file PmtHit.cxx. Referenced by GetPixel(), and Plot(). 00359 {
00360 const Int_t quotient = (pixel+1) / 8;
00361 const Int_t remainder = (pixel+1) % 8;
00362 Int_t pixel_x = quotient;
00363
00364 if(remainder == 0) pixel_x = quotient - 1;
00365
00366 //Int_t pixel_bin_x = 8 - pixel_x;
00367 //Int_t pixel_bin_y = 9 - pixel_y;
00368 const double x = 8 - pixel_x - 0.5;
00369 return x;
00370 }
|
|
|
Definition at line 374 of file PmtHit.cxx. Referenced by GetPixel(), and Plot(). 00375 {
00376 const Int_t remainder = (pixel+1) % 8;
00377 Int_t pixel_y = 8;
00378 if(remainder > 0) pixel_y = remainder;
00379
00380 //Int_t pixel_bin_x = 8 - pixel_x;
00381 //Int_t pixel_bin_y = 9 - pixel_y;
00382 const double y = - pixel_y + 0.5;
00383 return y;
00384 }
|
|
||||||||||||
|
Definition at line 330 of file PmtHit.cxx. References fDir, and Anp::SetDir(). 00331 {
00332 if(!fDir)
00333 {
00334 return 0;
00335 }
00336
00337 TH1 *h = HistMan::Instance().CreateTH1(key, "pmt");
00338 Anp::SetDir(h, fDir, name);
00339
00340 return h;
00341 }
|
|
||||||||||||
|
Definition at line 344 of file PmtHit.cxx. References fDir, and Anp::SetDir(). Referenced by GetPixel(). 00345 {
00346 if(!fDir)
00347 {
00348 return 0;
00349 }
00350
00351 TH2 *h = HistMan::Instance().CreateTH2(key, "pmt");
00352 Anp::SetDir(h, fDir, name);
00353
00354 return h;
00355 }
|
|
|
Definition at line 232 of file PmtHit.cxx. References f2dAboveN, f2dAboveP, f2dBelowN, f2dBelowP, f2dTrackN, f2dTrackP, fDir, fHeader, fOtherN, fOtherNCountAbove, fOtherNCountBelow, fOtherOverTrack, fOtherP, fStripDiffAboveN, fStripDiffAboveP, fStripDiffBelowN, fStripDiffBelowP, fStripOtherN, fStripOtherP, fStripTrackN, fStripTrackP, fTimeAbove, fTimeBelow, fTrackN, fTrackP, fValid, Anp::Header::IsFar(), and Anp::Header::IsNear(). 00233 {
00234 //
00235 // Create histograms if TDirectory is a valid pointer
00236 //
00237 if(!fDir || fValid) return false;
00238
00239 string prefix;
00240
00241 if(header.IsNear())
00242 {
00243 prefix = "near";
00244 }
00245 else if(header.IsFar())
00246 {
00247 prefix = "far";
00248 }
00249 else
00250 {
00251 return false;
00252 }
00253
00254 fHeader = header;
00255
00256 const unsigned int nmiss = HistMan::Instance().NMiss();
00257
00258 f2dAboveP = PmtHit::GetTH2(prefix + "_pmt_map", "pmt_other_signal_above");
00259 f2dBelowP = PmtHit::GetTH2(prefix + "_pmt_map", "pmt_other_signal_below");
00260 f2dBelowN = PmtHit::GetTH2(prefix + "_pmt_map", "pmt_other_ncount_above");
00261 f2dAboveN = PmtHit::GetTH2(prefix + "_pmt_map", "pmt_other_ncount_below");
00262 f2dTrackN = PmtHit::GetTH2(prefix + "_pmt_map", "pmt_track_signal");
00263 f2dTrackP = PmtHit::GetTH2(prefix + "_pmt_map", "pmt_track_ncount");
00264
00265 fOtherP = PmtHit::GetTH1("signal", "other_signal");
00266 fOtherN = PmtHit::GetTH1("ncount", "other_ncount");
00267
00268 fTrackP = PmtHit::GetTH1("signal", "track_signal");
00269 fTrackN = PmtHit::GetTH1("ncount", "track_ncount");
00270
00271 fStripDiffAboveP = PmtHit::GetTH1("diff", "diff_strip_above_signal");
00272 fStripDiffAboveN = PmtHit::GetTH1("diff", "diff_strip_above_ncount");
00273 fStripDiffBelowP = PmtHit::GetTH1("diff", "diff_strip_below_signal");
00274 fStripDiffBelowN = PmtHit::GetTH1("diff", "diff_strip_below_ncount");
00275
00276 fStripTrackP = PmtHit::GetTH1("strip", "track_strip_signal");
00277 fStripTrackN = PmtHit::GetTH1("strip", "track_strip_ncount");
00278 fStripOtherP = PmtHit::GetTH1("strip", "other_strip_signal");
00279 fStripOtherN = PmtHit::GetTH1("strip", "other_strip_ncount");
00280
00281 fOtherNCountAbove = PmtHit::GetTH1("ncount", "other_ncount_above");
00282 fOtherNCountBelow = PmtHit::GetTH1("ncount", "other_ncount_below");
00283 fOtherOverTrack = PmtHit::GetTH1("other_over_track");
00284
00285 fTimeAbove = PmtHit::GetTH1("time", "other_time_above");
00286 fTimeBelow = PmtHit::GetTH1("time", "other_time_below");
00287
00288 //
00289 // Count number of missed histograms
00290 //
00291 if(nmiss == HistMan::Instance().NMiss())
00292 {
00293 fValid = true;
00294 }
00295
00296 return fValid;
00297 }
|
|
|
Definition at line 75 of file PmtHit.cxx. References f2dAboveN, f2dAboveP, f2dBelowN, f2dBelowP, f2dTrackN, f2dTrackP, fDir, fHeader, fOtherN, fOtherNCountAbove, fOtherNCountBelow, fOtherOverTrack, fOtherP, fPixelN, fPixelP, fPlotPixel, fStripDiffAboveN, fStripDiffAboveP, fStripDiffBelowN, fStripDiffBelowP, fStripOtherN, fStripOtherP, fStripTrackN, fStripTrackP, fTimeAbove, fTimeBelow, fTrackN, fTrackP, Anp::Strip::GetEncoded(), Anp::PlaneHitColl::GetOtherVec(), GetPixel(), PlexPixelSpotId::GetPixel(), PlexHandle::GetPixelSpotId(), GetPixelXCoordinate(), GetPixelYCoordinate(), Anp::PlaneHitColl::GetPlane(), Anp::Strip::GetStrip(), Anp::PlaneHitColl::GetTrackVec(), Anp::Header::IsValid(), Anp::Strip::PE(), and Anp::Strip::Time(). 00076 {
00077 if(!fDir || !fHeader.IsValid())
00078 {
00079 return;
00080 }
00081
00082 const vector<StripIter> &ovec = plane.GetOtherVec();
00083 const vector<StripIter> &tvec = plane.GetTrackVec();
00084
00085 PlexHandle plex(Pmt::GetValidity(fHeader));
00086
00087 int strip_track = -1;
00088 double time = 0.0, signal_max = 0.0, signal_track = 0.0;
00089
00090 TH2 *phistN = 0;
00091 TH2 *phistP = 0;
00092
00093 for(vector<StripIter>::const_iterator sit = tvec.begin(); sit != tvec.end(); ++sit)
00094 {
00095 const Strip &strip = *(*sit);
00096
00097 const PlexStripEndId seid(strip.GetEncoded());
00098 const PlexPixelSpotId psid = plex.GetPixelSpotId(seid);
00099
00100 const float pixelX = GetPixelXCoordinate(psid.GetPixel());
00101 const float pixelY = GetPixelYCoordinate(psid.GetPixel());
00102 const float signal = strip.PE();
00103
00104 time += strip.Time();
00105 signal_track += signal;
00106
00107 assert(psid.GetPixel() < 64 && "wrong pixel number");
00108
00109 f2dTrackN -> Fill(pixelX, pixelY);
00110 f2dTrackP -> Fill(pixelX, pixelY, signal);
00111
00112 fStripTrackN -> Fill(strip.GetStrip() + 0.5);
00113 fStripTrackP -> Fill(strip.GetStrip() + 0.5, signal);
00114
00115 fTrackP -> Fill(signal);
00116
00117 if(fPlotPixel && tvec.size() == 1)
00118 {
00119 phistN = PmtHit::GetPixel(fPixelN, psid.GetPixel(), "other_ncount");
00120 phistP = PmtHit::GetPixel(fPixelP, psid.GetPixel(), "other_signal");
00121 }
00122
00123 if(signal_max < signal)
00124 {
00125 signal_max = signal;
00126 strip_track = strip.GetStrip();
00127 }
00128 }
00129
00130 fTrackN -> Fill(tvec.size());
00131
00132 if(tvec.empty())
00133 {
00134 cerr << "PmtHit::Plot - no track hits in plane: " << plane.GetPlane() << endl;
00135 return;
00136 }
00137
00138 //
00139 // Find average track hit time
00140 //
00141 time /= tvec.size();
00142
00143 double countA = 0.0, countB = 0.0;
00144
00145 for(vector<StripIter>::const_iterator sit = ovec.begin(); sit != ovec.end(); ++sit)
00146 {
00147 const Strip &strip = *(*sit);
00148
00149 const PlexStripEndId seid(strip.GetEncoded());
00150 const PlexPixelSpotId psid = plex.GetPixelSpotId(seid);
00151
00152 assert(psid.GetPixel() < 64 && "wrong pixel number");
00153
00154 const float pixelX = GetPixelXCoordinate(psid.GetPixel());
00155 const float pixelY = GetPixelYCoordinate(psid.GetPixel());
00156 const float signal = strip.PE();
00157 const double tdiff = 1.0e9*(strip.Time() - time);
00158
00159 if(signal > fSignalCut)
00160 {
00161 ++countA;
00162 f2dAboveN -> Fill(pixelX, pixelY);
00163 f2dAboveP -> Fill(pixelX, pixelY, signal);
00164 fTimeAbove -> Fill(tdiff);
00165
00166 if(strip_track > 0)
00167 {
00168 fStripDiffAboveN -> Fill(strip.GetStrip() - strip_track);
00169 fStripDiffAboveP -> Fill(strip.GetStrip() - strip_track, signal);
00170 }
00171 }
00172 else
00173 {
00174 ++countB;
00175 f2dBelowN -> Fill(pixelX, pixelY);
00176 f2dBelowP -> Fill(pixelX, pixelY, signal);
00177 fTimeBelow -> Fill(tdiff);
00178
00179 if(strip_track > 0)
00180 {
00181 fStripDiffBelowN -> Fill(strip.GetStrip() - strip_track);
00182 fStripDiffBelowP -> Fill(strip.GetStrip() - strip_track, signal);
00183 }
00184 }
00185
00186 fStripOtherN -> Fill(strip.GetStrip() + 0.5);
00187 fStripOtherP -> Fill(strip.GetStrip() + 0.5, signal);
00188
00189 fOtherP -> Fill(signal);
00190
00191 if(phistN) phistN -> Fill(pixelX, pixelY);
00192 if(phistP) phistP -> Fill(pixelX, pixelY, signal);
00193
00194 if(signal_track > 0.0)
00195 {
00196 fOtherOverTrack -> Fill(signal/signal_track);
00197 }
00198 }
00199
00200 fOtherN -> Fill(ovec.size());
00201
00202 fOtherNCountAbove -> Fill(countA);
00203 fOtherNCountBelow -> Fill(countB);
00204
00205 }
|
|
|
Definition at line 226 of file PmtHit.cxx. References fDir. 00227 {
00228 fDir = dir;
00229 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 74 of file PmtHit.h. Referenced by GetPixel(), GetTH1(), GetTH2(), Init(), Plot(), and Set(). |
|
|
Definition at line 81 of file PmtHit.h. Referenced by GetPixel(), Init(), and Plot(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 115 of file PmtHit.h. Referenced by Plot(). |
|
|
Definition at line 116 of file PmtHit.h. Referenced by Plot(). |
|
|
|
|
|
Definition at line 76 of file PmtHit.h. Referenced by Config(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 78 of file PmtHit.h. Referenced by Init(). |
1.3.9.1