AlignmentRunSummary Class Reference

#include <AlignmentRunSummary.h>

List of all members.

Public Member Functions

 AlignmentRunSummary ()
virtual ~AlignmentRunSummary ()
void Fill (const NtpAlignmentRecord *ntprec)
TTree * FillSummaryTree (TFile *rootfile)
unsigned int GetNSubRuns () const
int GetCurrentRun () const
int GetCurrentSubRun () const

Private Member Functions

void FillSummary (const unsigned int n, SubsetStat &stat, map< unsigned int, SubsetSummary > &summary_map)
double GetSubsetMean (const unsigned int nsubset, const map< unsigned int, SubsetSummary > &summary) const
double GetSubsetSigma (const unsigned int nsubset, const map< unsigned int, SubsetSummary > &summary) const
unsigned int GetSubsetSize (const unsigned int nsubset, const map< unsigned int, SubsetSummary > &summary) const
double GetSubsetSum (const unsigned int nsubset, const map< unsigned int, SubsetSummary > &summary) const

Private Attributes

SubsetStat fVCandNStrip
map< unsigned int, SubsetSummaryfVCandNStripSummary
SubsetStat fUCandNStrip
map< unsigned int, SubsetSummaryfUCandNStripSummary
SubsetStat fVCandCharge
map< unsigned int, SubsetSummaryfVCandChargeSummary
SubsetStat fUCandCharge
map< unsigned int, SubsetSummaryfUCandChargeSummary
SubsetStat fVTrackNStrip
map< unsigned int, SubsetSummaryfVTrackNStripSummary
SubsetStat fUTrackNStrip
map< unsigned int, SubsetSummaryfUTrackNStripSummary
SubsetStat fVTrackCharge
map< unsigned int, SubsetSummaryfVTrackChargeSummary
SubsetStat fUTrackCharge
map< unsigned int, SubsetSummaryfUTrackChargeSummary
map< unsigned int, int > fmSubsetRunNumber
map< unsigned int, int > fmSubsetSubRunNumber
map< unsigned int, VldContextfmSubsetVldContext
unsigned int fNumberOfSubRuns
int fCurrentRun
int fCurrentSubRun

Detailed Description

Definition at line 35 of file AlignmentRunSummary.h.


Constructor & Destructor Documentation

AlignmentRunSummary::AlignmentRunSummary (  ) 

Definition at line 31 of file AlignmentRunSummary.cxx.

00032    :fNumberOfSubRuns(0),
00033     fCurrentRun(0),
00034     fCurrentSubRun(0)
00035 {
00036 }

AlignmentRunSummary::~AlignmentRunSummary (  )  [virtual]

Definition at line 311 of file AlignmentRunSummary.cxx.

00312 {
00313 }


Member Function Documentation

void AlignmentRunSummary::Fill ( const NtpAlignmentRecord ntprec  ) 

Definition at line 39 of file AlignmentRunSummary.cxx.

References fCurrentRun, fCurrentSubRun, SubsetStat::Fill(), FillSummary(), fmSubsetRunNumber, fmSubsetSubRunNumber, fmSubsetVldContext, fNumberOfSubRuns, fUCandCharge, fUCandChargeSummary, fUCandNStrip, fUCandNStripSummary, fUTrackCharge, fUTrackChargeSummary, fUTrackNStrip, fUTrackNStripSummary, fVCandCharge, fVCandChargeSummary, fVCandNStrip, fVCandNStripSummary, fVTrackCharge, fVTrackChargeSummary, fVTrackNStrip, fVTrackNStripSummary, RecDataHeader::GetRun(), RecDataHeader::GetSubRun(), RecHeader::GetVldContext(), and run().

Referenced by MakeAlignmentModule::Ana(), and FillSummaryTree().

00040 {
00041    if(!ntprec) return;
00042 
00043    const RecCandHeader candheader = ntprec -> GetHeader();      
00044    const int run    = candheader.GetRun();
00045    const int subrun = candheader.GetSubRun();
00046 
00047    if(fNumberOfSubRuns == 0 && fCurrentRun == 0 && fCurrentSubRun == 0)
00048    {
00049       fCurrentRun    = run;
00050       fCurrentSubRun = subrun;
00051    }
00052 
00053    if(fCurrentRun != run || fCurrentSubRun != subrun)
00054    {
00055       fNumberOfSubRuns++;  
00056       
00057       FillSummary(fNumberOfSubRuns, fVCandNStrip, fVCandNStripSummary);
00058       FillSummary(fNumberOfSubRuns, fUCandNStrip, fUCandNStripSummary);
00059       FillSummary(fNumberOfSubRuns, fVCandCharge, fVCandChargeSummary);
00060       FillSummary(fNumberOfSubRuns, fUCandCharge, fUCandChargeSummary);
00061       
00062       FillSummary(fNumberOfSubRuns, fVTrackNStrip, fVTrackNStripSummary);
00063       FillSummary(fNumberOfSubRuns, fUTrackNStrip, fUTrackNStripSummary);
00064       FillSummary(fNumberOfSubRuns, fVTrackCharge, fVTrackChargeSummary);
00065       FillSummary(fNumberOfSubRuns, fUTrackCharge, fUTrackChargeSummary);
00066 
00067       //const VldContext *vldc = ntprec -> GetHeader() -> GetVldContext());
00068       VldContext vldc(candheader.GetVldContext());
00069       
00070       pair<unsigned int, VldContext> p_vld(fNumberOfSubRuns, vldc);
00071       fmSubsetVldContext.insert(p_vld);
00072       
00073       pair<unsigned int, int> p_run(fNumberOfSubRuns, run);
00074       fmSubsetRunNumber.insert(p_run);
00075       
00076       pair<unsigned int, int> p_subrun(fNumberOfSubRuns, subrun);
00077       fmSubsetSubRunNumber.insert(p_subrun);
00078       
00079       fCurrentRun    = run;
00080       fCurrentSubRun = subrun;
00081    }
00082    
00083    fVCandNStrip.Fill(ntprec -> ncandvstrip);
00084    fUCandNStrip.Fill(ntprec -> ncandustrip);
00085    fVCandCharge.Fill(ntprec -> vcandcharge);
00086    fUCandCharge.Fill(ntprec -> ucandcharge);
00087    
00088    fVTrackNStrip.Fill(ntprec -> ntrackvstrip);
00089    fUTrackNStrip.Fill(ntprec -> ntrackustrip);
00090    fVTrackCharge.Fill(ntprec -> vcharge);
00091    fUTrackCharge.Fill(ntprec -> ucharge);
00092 }

void AlignmentRunSummary::FillSummary ( const unsigned int  n,
SubsetStat stat,
map< unsigned int, SubsetSummary > &  summary_map 
) [private]

Definition at line 95 of file AlignmentRunSummary.cxx.

References SubsetStat::GetMean(), SubsetStat::GetSigma(), SubsetStat::GetSize(), SubsetStat::GetSum(), SubsetSummary::mean, SubsetStat::Reset(), SubsetSummary::sigma, SubsetSummary::size, and SubsetSummary::sum.

Referenced by Fill().

00097 {
00098    SubsetSummary summary;
00099    summary.mean  = stat.GetMean();
00100    summary.sigma = stat.GetSigma();
00101    summary.size  = stat.GetSize();
00102    summary.sum   = stat.GetSum();
00103 
00104    pair<unsigned int, SubsetSummary> p(n, summary);
00105    summary_map.insert(p);
00106    stat.Reset();
00107 }

TTree * AlignmentRunSummary::FillSummaryTree ( TFile *  rootfile  ) 

Definition at line 110 of file AlignmentRunSummary.cxx.

References Fill(), fmSubsetRunNumber, fmSubsetSubRunNumber, fmSubsetVldContext, fUCandChargeSummary, fUCandNStripSummary, fUTrackChargeSummary, fUTrackNStripSummary, fVCandChargeSummary, fVCandNStripSummary, fVTrackChargeSummary, fVTrackNStripSummary, VldTimeStamp::GetDate(), VldTimeStamp::GetSec(), GetSubsetMean(), GetSubsetSigma(), GetSubsetSize(), GetSubsetSum(), VldTimeStamp::GetTime(), VldContext::GetTimeStamp(), Msg::kError, MSG, run(), and Munits::second.

Referenced by MakeAlignmentModule::EndJob().

00111 {
00112    if(!rootfile)
00113    {
00114       MSG("Align", Msg::kError) << "Invalid root file pointer. Bailing out." << endl;
00115       return 0;
00116    }
00117    
00118    TTree *tree = new TTree("RunSummary","run summary");
00119    tree -> SetDirectory(rootfile);
00120    
00121    Int_t run, subrun;   
00122    Int_t second, date, time;
00123    UInt_t number_of_records, entry_number;
00124 
00125    Double_t mean_of_vtrack_nstrip,  mean_of_utrack_nstrip;
00126    Double_t mean_of_vtrack_charge,  mean_of_utrack_charge;
00127    Double_t sigma_of_vtrack_nstrip, sigma_of_utrack_nstrip;
00128    Double_t sigma_of_vtrack_charge, sigma_of_utrack_charge;
00129    Double_t sum_of_vtrack_nstrip,  sum_of_utrack_nstrip;
00130    Double_t sum_of_vtrack_charge,  sum_of_utrack_charge;
00131 
00132    Double_t mean_of_vcandnstrip,  mean_of_ucandnstrip;
00133    Double_t mean_of_vcandcharge,  mean_of_ucandcharge;
00134    Double_t sigma_of_vcandnstrip, sigma_of_ucandnstrip;
00135    Double_t sigma_of_vcandcharge, sigma_of_ucandcharge;
00136    Double_t sum_of_vcandnstrip,  sum_of_ucandnstrip;
00137    Double_t sum_of_vcandcharge,  sum_of_ucandcharge;
00138  
00139    tree -> Branch("run", &run, "run/I");
00140    tree -> Branch("subrun", &subrun, "subrun/I");
00141    tree -> Branch("second", &second, "second/I");
00142    tree -> Branch("date", &date, "date/I");
00143    tree -> Branch("time", &time, "time/I");
00144    tree -> Branch("entry_number", &entry_number, "entry_number/i");
00145    tree -> Branch("number_of_records", &number_of_records, "number_of_records/i");
00146 
00147    tree -> Branch("mean_of_vtrack_nstrip",  &mean_of_vtrack_nstrip,  "mean_of_vtrack_nstrip/D");
00148    tree -> Branch("mean_of_utrack_nstrip",  &mean_of_utrack_nstrip,  "mean_of_utrack_nstrip/D");
00149    tree -> Branch("mean_of_vtrack_charge",  &mean_of_vtrack_charge,  "mean_of_vtrack_charge/D");
00150    tree -> Branch("mean_of_utrack_charge",  &mean_of_utrack_charge,  "mean_of_utrack_charge/D");
00151    
00152    tree -> Branch("sum_of_vtrack_nstrip",  &sum_of_vtrack_nstrip,  "sum_of_vtrack_nstrip/D");
00153    tree -> Branch("sum_of_utrack_nstrip",  &sum_of_utrack_nstrip,  "sum_of_utrack_nstrip/D");
00154    tree -> Branch("sum_of_vtrack_charge",  &sum_of_vtrack_charge,  "sum_of_vtrack_charge/D");
00155    tree -> Branch("sum_of_utrack_charge",  &sum_of_utrack_charge,  "sum_of_utrack_charge/D");
00156   
00157    tree -> Branch("sigma_of_vtrack_nstrip", &sigma_of_vtrack_nstrip, "sigma_of_vtrack_nstrip/D");
00158    tree -> Branch("sigma_of_utrack_nstrip", &sigma_of_utrack_nstrip, "sigma_of_utrack_nstrip/D");
00159    tree -> Branch("sigma_of_vtrack_charge", &sigma_of_vtrack_charge, "sigma_of_vtrack_charge/D");
00160    tree -> Branch("sigma_of_utrack_charge", &sigma_of_utrack_charge, "sigma_of_utrack_charge/D");
00161 
00162    tree -> Branch("mean_of_vcandnstrip",  &mean_of_vcandnstrip,  "mean_of_vcandnstrip/D");
00163    tree -> Branch("mean_of_ucandnstrip",  &mean_of_ucandnstrip,  "mean_of_ucandnstrip/D");
00164    tree -> Branch("mean_of_vcandcharge",  &mean_of_vcandcharge,  "mean_of_vcandcharge/D");
00165    tree -> Branch("mean_of_ucandcharge",  &mean_of_ucandcharge,  "mean_of_ucandcharge/D");
00166 
00167    tree -> Branch("sum_of_vcandnstrip",  &sum_of_vcandnstrip,  "sum_of_vcandnstrip/D");
00168    tree -> Branch("sum_of_ucandnstrip",  &sum_of_ucandnstrip,  "sum_of_ucandnstrip/D");
00169    tree -> Branch("sum_of_vcandcharge",  &sum_of_vcandcharge,  "sum_of_vcandcharge/D");
00170    tree -> Branch("sum_of_ucandcharge",  &sum_of_ucandcharge,  "sum_of_ucandcharge/D");
00171 
00172    tree -> Branch("sigma_of_vcandnstrip", &sigma_of_vcandnstrip, "sigma_of_vcandnstrip/D");
00173    tree -> Branch("sigma_of_ucandnstrip", &sigma_of_ucandnstrip, "sigma_of_ucandnstrip/D");
00174    tree -> Branch("sigma_of_vcandcharge", &sigma_of_vcandcharge, "sigma_of_vcandcharge/D");
00175    tree -> Branch("sigma_of_ucandcharge", &sigma_of_ucandcharge, "sigma_of_ucandcharge/D");
00176    
00177    for(map<unsigned int, VldContext>::const_iterator vit = fmSubsetVldContext.begin();
00178        vit !=  fmSubsetVldContext.end(); ++vit)
00179    {
00180       entry_number = vit -> first;
00181       const VldContext vldc  = vit -> second;
00182       const VldTimeStamp vts = vldc.GetTimeStamp();
00183       second = vts.GetSec();
00184       date   = vts.GetDate();
00185       time   = vts.GetTime();
00186       
00187 
00188       map<unsigned int, int>:: const_iterator run_it = fmSubsetRunNumber.find(entry_number);
00189       if(run_it == fmSubsetRunNumber.end())
00190       {
00191          MSG("Align", Msg::kError) << "Failed to find map item." << endl;
00192          run = -1;
00193       }else
00194          run = run_it -> second;
00195       
00196       run_it = fmSubsetSubRunNumber.find(entry_number);
00197       if(run_it == fmSubsetSubRunNumber.end())
00198       {
00199          MSG("Align", Msg::kError) << "Failed to find map item." << endl;
00200          subrun = -1;
00201       }else
00202          subrun = run_it -> second;
00203 
00204       number_of_records = GetSubsetSize(entry_number, fVTrackNStripSummary);
00205       
00206       //strips on track
00207       mean_of_vtrack_nstrip = GetSubsetMean(entry_number, fVTrackNStripSummary);
00208       mean_of_utrack_nstrip = GetSubsetMean(entry_number, fUTrackNStripSummary);
00209 
00210       mean_of_vtrack_charge = GetSubsetMean(entry_number, fVTrackChargeSummary);
00211       mean_of_utrack_charge = GetSubsetMean(entry_number, fUTrackChargeSummary);
00212 
00213       sum_of_vtrack_nstrip = GetSubsetSum(entry_number, fVTrackNStripSummary);
00214       sum_of_utrack_nstrip = GetSubsetSum(entry_number, fUTrackNStripSummary);
00215 
00216       sum_of_vtrack_charge = GetSubsetSum(entry_number, fVTrackChargeSummary);
00217       sum_of_utrack_charge = GetSubsetSum(entry_number, fUTrackChargeSummary);
00218 
00219       sigma_of_vtrack_nstrip = GetSubsetSigma(entry_number, fVTrackNStripSummary);
00220       sigma_of_utrack_nstrip = GetSubsetSigma(entry_number, fUTrackNStripSummary);
00221 
00222       sigma_of_vtrack_charge = GetSubsetSigma(entry_number, fVTrackChargeSummary); 
00223       sigma_of_utrack_charge = GetSubsetSigma(entry_number, fUTrackChargeSummary);
00224       
00225       //strips not on track
00226       mean_of_vcandnstrip = GetSubsetMean(entry_number, fVCandNStripSummary);
00227       mean_of_ucandnstrip = GetSubsetMean(entry_number, fUCandNStripSummary);
00228 
00229       mean_of_vcandcharge = GetSubsetMean(entry_number, fVCandChargeSummary);
00230       mean_of_ucandcharge = GetSubsetMean(entry_number, fUCandChargeSummary);
00231 
00232       sum_of_vcandnstrip = GetSubsetSum(entry_number, fVCandNStripSummary);
00233       sum_of_ucandnstrip = GetSubsetSum(entry_number, fUCandNStripSummary);
00234 
00235       sum_of_vcandcharge = GetSubsetSum(entry_number, fVCandChargeSummary);
00236       sum_of_ucandcharge = GetSubsetSum(entry_number, fUCandChargeSummary);
00237 
00238       sigma_of_vcandnstrip = GetSubsetSigma(entry_number, fVCandNStripSummary);
00239       sigma_of_ucandnstrip = GetSubsetSigma(entry_number, fUCandNStripSummary);
00240 
00241       sigma_of_vcandcharge = GetSubsetSigma(entry_number, fVCandChargeSummary);
00242       sigma_of_ucandcharge = GetSubsetSigma(entry_number, fUCandChargeSummary);
00243 
00244       tree -> Fill();
00245    }
00246    
00247    return tree;
00248 }

int AlignmentRunSummary::GetCurrentRun (  )  const [inline]

Definition at line 49 of file AlignmentRunSummary.h.

References fCurrentRun.

00049 {return fCurrentRun;};

int AlignmentRunSummary::GetCurrentSubRun (  )  const [inline]

Definition at line 50 of file AlignmentRunSummary.h.

References fCurrentSubRun.

00050 {return fCurrentSubRun;};

unsigned int AlignmentRunSummary::GetNSubRuns (  )  const [inline]

Definition at line 48 of file AlignmentRunSummary.h.

References fNumberOfSubRuns.

00048 {return fNumberOfSubRuns;};

double AlignmentRunSummary::GetSubsetMean ( const unsigned int  nsubset,
const map< unsigned int, SubsetSummary > &  summary 
) const [private]

Definition at line 251 of file AlignmentRunSummary.cxx.

References Msg::kError, SubsetSummary::mean, MSG, and Munits::second.

Referenced by FillSummaryTree().

00253 {
00254    map<unsigned int, SubsetSummary>::const_iterator fit = summary.find(nsubset);
00255    if(fit == summary.end())
00256    {
00257       MSG("Align", Msg::kError) << "Failed to find map item." << endl;
00258       return -1.0;
00259    }
00260    
00261    const SubsetSummary &s = fit -> second;
00262    return s.mean;
00263 }

double AlignmentRunSummary::GetSubsetSigma ( const unsigned int  nsubset,
const map< unsigned int, SubsetSummary > &  summary 
) const [private]

Definition at line 266 of file AlignmentRunSummary.cxx.

References Msg::kError, MSG, Munits::second, and SubsetSummary::sigma.

Referenced by FillSummaryTree().

00268 {
00269    map<unsigned int, SubsetSummary>::const_iterator fit = summary.find(nsubset);
00270    if(fit == summary.end())
00271    {
00272       MSG("Align", Msg::kError) << "Failed to find map item." << endl;
00273       return -1.0;
00274    }
00275    
00276    const SubsetSummary &s = fit -> second;
00277    return s.sigma;
00278 }

unsigned int AlignmentRunSummary::GetSubsetSize ( const unsigned int  nsubset,
const map< unsigned int, SubsetSummary > &  summary 
) const [private]

Definition at line 281 of file AlignmentRunSummary.cxx.

References Msg::kError, MSG, Munits::second, and SubsetSummary::size.

Referenced by FillSummaryTree().

00283 {
00284    map<unsigned int, SubsetSummary>::const_iterator fit = summary.find(nsubset);
00285    if(fit == summary.end())
00286    {
00287       MSG("Align", Msg::kError) << "Failed to find map item." << endl;
00288       return 0;
00289    }
00290    
00291    const SubsetSummary &s = fit -> second;
00292    return s.size;
00293 }  

double AlignmentRunSummary::GetSubsetSum ( const unsigned int  nsubset,
const map< unsigned int, SubsetSummary > &  summary 
) const [private]

Definition at line 296 of file AlignmentRunSummary.cxx.

References Msg::kError, MSG, Munits::second, and SubsetSummary::sum.

Referenced by FillSummaryTree().

00298 {
00299    map<unsigned int, SubsetSummary>::const_iterator fit = summary.find(nsubset);
00300    if(fit == summary.end())
00301    {
00302       MSG("Align", Msg::kError) << "Failed to find map item." << endl;
00303       return 0;
00304    }
00305    
00306    const SubsetSummary &s = fit -> second;
00307    return s.sum;
00308 }  


Member Data Documentation

Definition at line 99 of file AlignmentRunSummary.h.

Referenced by Fill(), and GetCurrentRun().

Definition at line 100 of file AlignmentRunSummary.h.

Referenced by Fill(), and GetCurrentSubRun().

map<unsigned int, int> AlignmentRunSummary::fmSubsetRunNumber [private]

Definition at line 93 of file AlignmentRunSummary.h.

Referenced by Fill(), and FillSummaryTree().

map<unsigned int, int> AlignmentRunSummary::fmSubsetSubRunNumber [private]

Definition at line 94 of file AlignmentRunSummary.h.

Referenced by Fill(), and FillSummaryTree().

Definition at line 96 of file AlignmentRunSummary.h.

Referenced by Fill(), and FillSummaryTree().

unsigned int AlignmentRunSummary::fNumberOfSubRuns [private]

Definition at line 98 of file AlignmentRunSummary.h.

Referenced by Fill(), and GetNSubRuns().

Definition at line 78 of file AlignmentRunSummary.h.

Referenced by Fill().

Definition at line 79 of file AlignmentRunSummary.h.

Referenced by Fill(), and FillSummaryTree().

Definition at line 72 of file AlignmentRunSummary.h.

Referenced by Fill().

Definition at line 73 of file AlignmentRunSummary.h.

Referenced by Fill(), and FillSummaryTree().

Definition at line 90 of file AlignmentRunSummary.h.

Referenced by Fill().

Definition at line 91 of file AlignmentRunSummary.h.

Referenced by Fill(), and FillSummaryTree().

Definition at line 84 of file AlignmentRunSummary.h.

Referenced by Fill().

Definition at line 85 of file AlignmentRunSummary.h.

Referenced by Fill(), and FillSummaryTree().

Definition at line 75 of file AlignmentRunSummary.h.

Referenced by Fill().

Definition at line 76 of file AlignmentRunSummary.h.

Referenced by Fill(), and FillSummaryTree().

Definition at line 69 of file AlignmentRunSummary.h.

Referenced by Fill().

Definition at line 70 of file AlignmentRunSummary.h.

Referenced by Fill(), and FillSummaryTree().

Definition at line 87 of file AlignmentRunSummary.h.

Referenced by Fill().

Definition at line 88 of file AlignmentRunSummary.h.

Referenced by Fill(), and FillSummaryTree().

Definition at line 81 of file AlignmentRunSummary.h.

Referenced by Fill().

Definition at line 82 of file AlignmentRunSummary.h.

Referenced by Fill(), and FillSummaryTree().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1