Anp::PmtHit Class Reference

#include <PmtHit.h>

Inheritance diagram for Anp::PmtHit:
Anp::Base

List of all members.

Public Types

typedef std::map< short, TH2 * > PixelMap

Public Member Functions

 PmtHit ()
virtual ~PmtHit ()
void Plot (const PlaneHitColl &plane)
void Config (const Registry &reg)
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

Detailed Description

Definition at line 43 of file PmtHit.h.


Member Typedef Documentation

typedef std::map<short, TH2 *> Anp::PmtHit::PixelMap

Definition at line 60 of file PmtHit.h.


Constructor & Destructor Documentation

Anp::PmtHit::PmtHit (  ) 

Definition at line 61 of file PmtHit.cxx.

00062    :fDir(0),
00063     fSignalCut(1.0),
00064     fValid(false),
00065     fPlotPixel(true)
00066 {
00067 }

Anp::PmtHit::~PmtHit (  )  [virtual]

Definition at line 70 of file PmtHit.cxx.

00071 {
00072 }


Member Function Documentation

void Anp::PmtHit::Config ( const Registry reg  ) 

Definition at line 208 of file PmtHit.cxx.

References fPlotPixel, fSignalCut, Registry::Get(), Registry::KeyExists(), and Anp::Read().

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 }

TH2* Anp::PmtHit::GetPixel ( PixelMap pmap,
short  pixel,
const std::string &  name 
) [private]

Referenced by Plot().

double Anp::PmtHit::GetPixelXCoordinate ( short  pixel  )  const [private]

Definition at line 358 of file PmtHit.cxx.

Referenced by 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 }

double Anp::PmtHit::GetPixelYCoordinate ( short  pixel  )  const [private]

Definition at line 374 of file PmtHit.cxx.

Referenced by 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 }

TH1* Anp::PmtHit::GetTH1 ( const std::string &  key,
const std::string &  name = "" 
) [private]

Referenced by Init().

TH2* Anp::PmtHit::GetTH2 ( const std::string &  key,
const std::string &  name = "" 
) [private]

Referenced by Init().

bool Anp::PmtHit::Init ( const Header header  ) 

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, GetTH1(), GetTH2(), Anp::HistMan::Instance(), Anp::Header::IsFar(), Anp::Header::IsNear(), and Anp::HistMan::NMiss().

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 }

void Anp::PmtHit::Plot ( const PlaneHitColl plane  ) 

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, fSignalCut, fStripDiffAboveN, fStripDiffAboveP, fStripDiffBelowN, fStripDiffBelowP, fStripOtherN, fStripOtherP, fStripTrackN, fStripTrackP, fTimeAbove, fTimeBelow, fTrackN, fTrackP, Anp::Strip::GetEncoded(), Anp::PlaneHitColl::GetOtherVec(), GetPixel(), PlexHandle::GetPixelSpotId(), GetPixelXCoordinate(), GetPixelYCoordinate(), Anp::PlaneHitColl::GetPlane(), Anp::Strip::GetStrip(), Anp::PlaneHitColl::GetTrackVec(), Anp::Pmt::GetValidity(), 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 }

void Anp::PmtHit::Set ( TDirectory *  dir  ) 

Definition at line 226 of file PmtHit.cxx.

References fDir.

00227 {
00228    fDir = dir;
00229 }


Member Data Documentation

TH2* Anp::PmtHit::f2dAboveN [private]

Definition at line 112 of file PmtHit.h.

Referenced by Init(), and Plot().

TH2* Anp::PmtHit::f2dAboveP [private]

Definition at line 106 of file PmtHit.h.

Referenced by Init(), and Plot().

TH2* Anp::PmtHit::f2dBelowN [private]

Definition at line 113 of file PmtHit.h.

Referenced by Init(), and Plot().

TH2* Anp::PmtHit::f2dBelowP [private]

Definition at line 107 of file PmtHit.h.

Referenced by Init(), and Plot().

TH2* Anp::PmtHit::f2dTrackN [private]

Definition at line 109 of file PmtHit.h.

Referenced by Init(), and Plot().

TH2* Anp::PmtHit::f2dTrackP [private]

Definition at line 110 of file PmtHit.h.

Referenced by Init(), and Plot().

TDirectory* Anp::PmtHit::fDir [private]

Definition at line 74 of file PmtHit.h.

Referenced by Init(), Plot(), and Set().

Definition at line 81 of file PmtHit.h.

Referenced by Init(), and Plot().

TH1* Anp::PmtHit::fOtherN [private]

Definition at line 84 of file PmtHit.h.

Referenced by Init(), and Plot().

Definition at line 99 of file PmtHit.h.

Referenced by Init(), and Plot().

Definition at line 100 of file PmtHit.h.

Referenced by Init(), and Plot().

Definition at line 101 of file PmtHit.h.

Referenced by Init(), and Plot().

TH1* Anp::PmtHit::fOtherP [private]

Definition at line 83 of file PmtHit.h.

Referenced by 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().

bool Anp::PmtHit::fPlotPixel [private]

Definition at line 79 of file PmtHit.h.

Referenced by Config(), and Plot().

double Anp::PmtHit::fSignalCut [private]

Definition at line 76 of file PmtHit.h.

Referenced by Config(), and Plot().

Definition at line 90 of file PmtHit.h.

Referenced by Init(), and Plot().

Definition at line 89 of file PmtHit.h.

Referenced by Init(), and Plot().

Definition at line 92 of file PmtHit.h.

Referenced by Init(), and Plot().

Definition at line 91 of file PmtHit.h.

Referenced by Init(), and Plot().

TH1* Anp::PmtHit::fStripOtherN [private]

Definition at line 97 of file PmtHit.h.

Referenced by Init(), and Plot().

TH1* Anp::PmtHit::fStripOtherP [private]

Definition at line 96 of file PmtHit.h.

Referenced by Init(), and Plot().

TH1* Anp::PmtHit::fStripTrackN [private]

Definition at line 95 of file PmtHit.h.

Referenced by Init(), and Plot().

TH1* Anp::PmtHit::fStripTrackP [private]

Definition at line 94 of file PmtHit.h.

Referenced by Init(), and Plot().

TH1* Anp::PmtHit::fTimeAbove [private]

Definition at line 103 of file PmtHit.h.

Referenced by Init(), and Plot().

TH1* Anp::PmtHit::fTimeBelow [private]

Definition at line 104 of file PmtHit.h.

Referenced by Init(), and Plot().

TH1* Anp::PmtHit::fTrackN [private]

Definition at line 87 of file PmtHit.h.

Referenced by Init(), and Plot().

TH1* Anp::PmtHit::fTrackP [private]

Definition at line 86 of file PmtHit.h.

Referenced by Init(), and Plot().

bool Anp::PmtHit::fValid [private]

Definition at line 78 of file PmtHit.h.

Referenced by Init().


The documentation for this class was generated from the following files:

Generated on 24 Jul 2018 for loon by  doxygen 1.6.1