PlotIntegralRatios Class Reference
[Modules]

A one line description of what your module does. More...

#include <PlotIntegralRatios.h>

Inheritance diagram for PlotIntegralRatios:
BaseModule

List of all members.

Classes

struct  SourcePlots_t

Public Member Functions

 PlotIntegralRatios (modules::options *opts)
 Constructor description. If necessary, add a details tag like above.
 ~PlotIntegralRatios ()
 Is anything done in the destructor?
int ProcessGenericEntry (TGlobalData *gData, const TSetupData *gSetup)
int Preprocess (TGlobalData *gData, const TSetupData *gSetup)
 Method called by the main pre-process loop.
int Postprocess (TGlobalData *gData, const TSetupData *gSetup)
 Method called by the main pre-process loop.
void SetAlias (const std::string &alias)
std::string GetAlias () const
const char * GetName () const
 Get the name of this module as given to the constructor of the base class.

Protected Member Functions

bool Debug () const
TDirectory * GetDirectory () const
 Get the TDirectory for this module.
TDirectory * GetDirectory (const std::string &name="")

Protected Attributes

TDirectory * dir

Private Types

typedef std::vector
< SourcePlots_t
SourceList_t

Private Member Functions

virtual int ProcessEntry (TGlobalData *gData, const TSetupData *gSetup)
 What's calculated for every entry? Don't hesitate to repeat what was said in the class description.
virtual int BeforeFirstEntry (TGlobalData *gData, const TSetupData *setup)
 What needes to be done before each run? Don't hesitate to repeat what was said in the class description.
virtual int AfterLastEntry (TGlobalData *gData, const TSetupData *setup)
 What needs to be done after each run? Don't hesitate to repeat what was said in the class description.

Private Attributes

SourceList_t fSourcesToPlot
IDs::source fSource
double fShiftFull
double fShiftDifference

Detailed Description

A one line description of what your module does.

Author:
AuthorName

A longer, more descriptive block of text. Specifics like members and methods will be described later. You can add this to other groups instead of rootana_modules or in addition to rootana_modules by adding more of the ingroup tags.

Definition at line 25 of file PlotIntegralRatios.h.


Member Typedef Documentation

typedef std::vector<SourcePlots_t> PlotIntegralRatios::SourceList_t [private]

Definition at line 33 of file PlotIntegralRatios.h.


Constructor & Destructor Documentation

PlotIntegralRatios::PlotIntegralRatios ( modules::options opts  ) 

Constructor description. If necessary, add a details tag like above.

Parameters:
[in] opts Describe the options this module takes.

Definition at line 20 of file PlotIntegralRatios.cpp.

References fShiftDifference, fShiftFull, and modules::options::GetDouble().

00020                                                           :
00021    BaseModule("PlotIntegralRatios",opts),
00022     fSource(opts->GetString("source","SiR2-*#IntegralRatio#any")){
00023     fShiftFull=opts->GetDouble("shift_full",0);
00024     fShiftDifference=opts->GetDouble("shift_diff",0);
00025 }

PlotIntegralRatios::~PlotIntegralRatios (  ) 

Is anything done in the destructor?

Definition at line 27 of file PlotIntegralRatios.cpp.

00027                                        {
00028 }


Member Function Documentation

int PlotIntegralRatios::AfterLastEntry ( TGlobalData gData,
const TSetupData setup 
) [private, virtual]

What needs to be done after each run? Don't hesitate to repeat what was said in the class description.

Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 188 of file PlotIntegralRatios.cpp.

00188                                                                                 {
00189   return 0;
00190 }

int PlotIntegralRatios::BeforeFirstEntry ( TGlobalData gData,
const TSetupData setup 
) [private, virtual]

What needes to be done before each run? Don't hesitate to repeat what was said in the class description.

Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 30 of file PlotIntegralRatios.cpp.

References PlotIntegralRatios::SourcePlots_t::diff_v_ratio, fSource, fSourcesToPlot, PlotIntegralRatios::SourcePlots_t::full_integral, PlotIntegralRatios::SourcePlots_t::full_v_ratio, PlotIntegralRatios::SourcePlots_t::full_v_tail, gAnalysedPulseMap, PlotIntegralRatios::SourcePlots_t::ratio, PlotIntegralRatios::SourcePlots_t::ratio_zoomed, PlotIntegralRatios::SourcePlots_t::src, IDs::source::str(), and modules::parser::ToCppValid().

00030                                                                                   {
00031     SourcePlots_t tmp;
00032     for(SourceAnalPulseMap::const_iterator i_source = gAnalysedPulseMap.begin();
00033             i_source!=gAnalysedPulseMap.end(); ++i_source){
00034         if(i_source->first.matches(fSource)){
00035             tmp.src=i_source->first;
00036 
00037             tmp.ratio=new TH1F(
00038                     modules::parser::ToCppValid("h"+tmp.src.str()+"_ratio").c_str(),
00039                     ("Ratio of integrals for "+tmp.src.str()).c_str(),
00040                     1000,0,1);
00041             tmp.ratio->SetXTitle("Ratio of total to tail integral");
00042             //tmp.ratio->SetDirectory(GetDirectory("ratios"));
00043 
00044             tmp.ratio_zoomed=new TH1F(
00045                     modules::parser::ToCppValid("h"+tmp.src.str()+"_ratio_zoomed").c_str(),
00046                     ("Zoomed Ratio of integrals for "+tmp.src.str()).c_str(),
00047                     2000,0.1,0.25);
00048             tmp.ratio_zoomed->SetXTitle("Ratio of total to tail integral");
00049             //tmp.ratio_zoomed->SetDirectory(GetDirectory("ratios"));
00050 
00051             tmp.full_integral=new TH1F(
00052                     modules::parser::ToCppValid("h"+tmp.src.str()+"_integral").c_str(),
00053                     ("Integrals for "+tmp.src.str()).c_str(),
00054                     1000,0,-1);
00055             tmp.full_integral->SetXTitle("Total integral");
00056             //tmp.full_integral->SetDirectory(GetDirectory("ratios"));
00057 
00058 //            tmp.assymetry=new TH1F(
00059 //                    modules::parser::ToCppValid("h"+tmp.src.str()+"_assymetry").c_str(),
00060 //                    ("Assymetry (first - second)/(first+second) for "+tmp.src.str()).c_str(),
00061 //                    200,0,-1);
00062 //            tmp.assymetry->SetXTitle("Assymetry of total to tail integral");
00064 //
00065 //            tmp.assymetry2d=new TH2F(
00066 //                    modules::parser::ToCppValid("h"+tmp.src.str()+"_assymetry2d").c_str(),
00067 //                    ("Assymetry (first - second) vs (first+second) for "+tmp.src.str()).c_str(),
00068 //                    200,0,-1,200,0,-1);
00069 //            tmp.assymetry2d->SetXTitle("Total integral");
00070 //            tmp.assymetry2d->SetYTitle("Difference between first and tail");
00072 
00073             tmp.full_v_tail=new TH2F(
00074                     modules::parser::ToCppValid("h"+tmp.src.str()+"_2d").c_str(),
00075                     ("Integrals for "+tmp.src.str()).c_str(),
00076                     400,0,-1,400,0,-1);
00077             tmp.full_v_tail->SetXTitle("tail integral");
00078             tmp.full_v_tail->SetYTitle("full integral");
00079             //tmp.full_v_tail->SetDirectory(GetDirectory("miscs"));
00080 
00081             tmp.full_v_ratio=new TH2F(
00082                     modules::parser::ToCppValid("h"+tmp.src.str()+"_integral_v_ratio").c_str(),
00083                     ("Integral vs ratio of tail to integral for "+tmp.src.str()).c_str(),
00084                     400,0,-3,400,0,-1);
00085             tmp.full_v_ratio->SetXTitle("ratio of tail to full integrals");
00086             tmp.full_v_ratio->SetYTitle("full integral");
00087             //tmp.full_v_ratio->SetDirectory(GetDirectory("miscs"));
00088 
00089             tmp.diff_v_ratio=new TH2F(
00090                     modules::parser::ToCppValid("h"+tmp.src.str()+"_diff_v_ratio").c_str(),
00091                     ("Difference vs ratio of tail to integral for "+tmp.src.str()).c_str(),
00092                     400,0,-1,400,0,-1);
00093             tmp.diff_v_ratio->SetXTitle("ratio of tail to full integrals");
00094             tmp.diff_v_ratio->SetYTitle("differente of tail to full integrals");
00095             //tmp.diff_v_ratio->SetDirectory(GetDirectory("miscs"));
00096 
00097             //tmp.mean_vs_min=new TH2F(
00098             //        modules::parser::ToCppValid("h"+tmp.src.str()+"_mean_vs_min").c_str(),
00099             //        ("mean vs min values for "+tmp.src.str()).c_str(),
00100             //        200,0,-1,200,0,-1);
00101             //tmp.mean_vs_min->SetXTitle("minimum value");
00102             //tmp.mean_vs_min->SetYTitle("mean value");
00103             //tmp.mean_vs_min->SetDirectory(GetDirectory("min_max_mean"));
00104 
00105             //tmp.mean_vs_max=new TH2F(
00106             //        modules::parser::ToCppValid("h"+tmp.src.str()+"_mean_vs_max").c_str(),
00107             //        ("mean vs max values for "+tmp.src.str()).c_str(),
00108             //        200,0,-1,200,0,-1);
00109             //tmp.mean_vs_max->SetXTitle("maximum value");
00110             //tmp.mean_vs_max->SetYTitle("mean value");
00111             //tmp.mean_vs_max->SetDirectory(GetDirectory("min_max_mean"));
00112 
00113             //tmp.mean=new TH1F(
00114             //        modules::parser::ToCppValid("h"+tmp.src.str()+"_mean").c_str(),
00115             //        ("mean value for "+tmp.src.str()).c_str(),
00116             //        400,0,-1);
00117             //tmp.mean->SetXTitle("mean value");
00118             //tmp.mean->SetDirectory(GetDirectory("min_max_mean"));
00119 
00120             //tmp.max=new TH1F(
00121             //        modules::parser::ToCppValid("h"+tmp.src.str()+"_max").c_str(),
00122             //        ("max value for "+tmp.src.str()).c_str(),
00123             //        400,0,-1);
00124             //tmp.max->SetXTitle("max value");
00125             //tmp.max->SetDirectory(GetDirectory("min_max_mean"));
00126 
00127             //tmp.min=new TH1F(
00128             //        modules::parser::ToCppValid("h"+tmp.src.str()+"_min").c_str(),
00129             //        ("min value for "+tmp.src.str()).c_str(),
00130             //        400,0,-1);
00131             //tmp.min->SetXTitle("min value");
00132             //tmp.min->SetDirectory(GetDirectory("min_max_mean"));
00133 
00134             fSourcesToPlot.push_back(tmp);
00135         }
00136     }
00137     if(fSourcesToPlot.empty()){
00138         cout<<"PlotIntegralRatios:BeforeFirstEntry: Error: No sources in gAnalysedPulseMap match "<<fSource<<endl;
00139         return 1;
00140     }
00141   return 0;
00142 }

bool BaseModule::Debug (  )  const [inline, protected, inherited]
std::string BaseModule::GetAlias (  )  const [inline, inherited]

Returns a string for the alias of this module. May be empty if no alias was given in the modules file.

Definition at line 63 of file BaseModule.h.

References BaseModule::fAlias.

Referenced by BaseModule::BaseModule().

00063 {return fAlias;};

TDirectory * BaseModule::GetDirectory ( const std::string &  name = ""  )  [protected, inherited]

Definition at line 77 of file BaseModule.cpp.

References BaseModule::dir, and BaseModule::fDirectory.

00077                                                          {
00078   if(name.empty()) return fDirectory;
00079   TDirectory* dir=fDirectory->GetDirectory(name.c_str());
00080   if(dir) return dir;
00081   return fDirectory->mkdir(name.c_str());
00082 }

TDirectory* BaseModule::GetDirectory (  )  const [inline, protected, inherited]
const char* BaseModule::GetName (  )  const [inline, inherited]

Get the name of this module as given to the constructor of the base class.

Definition at line 66 of file BaseModule.h.

References BaseModule::fName.

Referenced by SavePulses::BeforeFirstEntry(), PlotTDPs::BeforeFirstEntry(), PlotTDP_TDiff::BeforeFirstEntry(), PlotTAP_Time::ProcessEntry(), PlotTAP_Energy::ProcessEntry(), PlotTAP_Amplitude::ProcessEntry(), and LoopSequence::Run().

00066 {return fName.c_str();};

int BaseModule::Postprocess ( TGlobalData gData,
const TSetupData gSetup 
) [inherited]

Method called by the main pre-process loop.

Does some simple work, then hooks into the derived class through AfterLastEntry.

Returns:
0 on sucess and non-zero if a problem occurred

Definition at line 66 of file BaseModule.cpp.

References BaseModule::AfterLastEntry(), and BaseModule::fDirectory.

Referenced by LoopSequence::Postprocess().

00066                                                                        {
00067   // This is called by our main routine and would allow later to split into different 
00068   // process routines if we have more than one Tree and hence different tpyes of data input.
00069 
00070   if(fDirectory) fDirectory->cd();
00071   int ret = AfterLastEntry(gData, gSetup);
00072   gDirectory->cd("/");
00073 
00074   return ret;
00075 }

int BaseModule::Preprocess ( TGlobalData gData,
const TSetupData gSetup 
) [inherited]

Method called by the main pre-process loop.

Does some simple work, then hooks into the derived class through BeforeFirstEntry.

Returns:
0 on sucess and non-zero if a problem occurred

Definition at line 55 of file BaseModule.cpp.

References BaseModule::BeforeFirstEntry(), and BaseModule::fDirectory.

Referenced by LoopSequence::Preprocess().

00055                                                                       {
00056   // This is called by our main routine and would allow later to split into different 
00057   // process routines if we have more than one Tree and hence different tpyes of data input.
00058 
00059   if(fDirectory) fDirectory->cd();
00060   int ret = BeforeFirstEntry(gData, gSetup);
00061   gDirectory->cd("/");
00062 
00063   return ret;
00064 }

int PlotIntegralRatios::ProcessEntry ( TGlobalData gData,
const TSetupData gSetup 
) [private, virtual]

What's calculated for every entry? Don't hesitate to repeat what was said in the class description.

Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 144 of file PlotIntegralRatios.cpp.

References fShiftDifference, fSourcesToPlot, gAnalysedPulseMap, TAnalysedPulse::GetIntegral(), TIntegralRatioAnalysedPulse::GetIntegralRatio(), and TIntegralRatioAnalysedPulse::GetIntegralSmall().

00144                                                                               {
00145     TIntegralRatioAnalysedPulse* pulse=0;
00146     for(SourceList_t::const_iterator i_source=fSourcesToPlot.begin();
00147             i_source!=fSourcesToPlot.end(); ++i_source){
00148         const AnalysedPulseList& pulseList=gAnalysedPulseMap.at(i_source->src);
00149         for(AnalysedPulseList::const_iterator i_pulse=pulseList.begin();
00150                 i_pulse!=pulseList.end(); ++i_pulse){
00151             if(i_pulse==pulseList.begin()){
00152                 pulse=dynamic_cast<TIntegralRatioAnalysedPulse*>(*i_pulse);
00153                 if(!pulse) {
00154                     cout<<"PlotIntegralRatios::ProcessEntry: Error: Pulses in "<<i_source->src
00155                         <<" aren't of type TIntegralRatioAnalysedPulse"<<endl;
00156                     return 2;
00157                 }
00158             }else{
00159                 pulse=static_cast<TIntegralRatioAnalysedPulse*>(*i_pulse);
00160             }
00161             double ratio=pulse->GetIntegralRatio();
00162             double full=pulse->GetIntegral();
00163             double tail=pulse->GetIntegralSmall();
00164             double diff=full-2*tail-fShiftDifference;
00165             i_source->ratio->Fill(ratio);
00166             i_source->ratio_zoomed->Fill(ratio);
00167             i_source->full_integral->Fill(full);
00168             i_source->full_v_tail->Fill(tail,full);
00169             i_source->full_v_ratio->Fill(ratio,full);
00170             i_source->diff_v_ratio->Fill(ratio,diff);
00171             //i_source->assymetry->Fill(diff/(full-fShiftFull));
00172             //i_source->assymetry2d->Fill(full,(full-2*tail));
00173 
00174             //double mean=pulse->GetMean();
00175             //double min=pulse->GetMin();
00176             //double max=pulse->GetMax();
00177             //i_source->mean->Fill(mean);
00178             //i_source->max->Fill(max);
00179             //i_source->min->Fill(min);
00180             //i_source->mean_vs_min->Fill(min,mean);
00181             //i_source->mean_vs_max->Fill(max,mean);
00182         }
00183 
00184     }
00185   return 0;
00186 }

int BaseModule::ProcessGenericEntry ( TGlobalData gData,
const TSetupData gSetup 
) [inherited]

Method called by the main event loop for each entry in the input root tree. Does some simple work, then hooks into the derived class through ProcessEntry.

Returns:
0 on sucess and non-zero if a problem occurred

Definition at line 44 of file BaseModule.cpp.

References BaseModule::fDirectory, and BaseModule::ProcessEntry().

Referenced by LoopSequence::Process().

00044                                                                                {
00045   // This is called by our main routine and would allow later to split into different 
00046   // process routines if we have more than one Tree and hence different tpyes of data input.
00047 
00048   if(fDirectory) fDirectory->cd();
00049   int ret = ProcessEntry(gData, gSetup);
00050   gDirectory->cd("/");
00051 
00052   return ret;
00053 }

void BaseModule::SetAlias ( const std::string &  alias  )  [inline, inherited]

Sets the alias for this module, which should be provided in the modules file

Definition at line 59 of file BaseModule.h.

References BaseModule::fAlias.

Referenced by BaseModule::BaseModule().

00059 {fAlias=alias;};


Member Data Documentation

TDirectory* BaseModule::dir [protected, inherited]

Many modules use 'dir' still which was the old protected pointer to the modules directory. To prevent things being broken so soon, we keep this pointer available, but be warned that it will be removed shortly...

Definition at line 98 of file BaseModule.h.

Referenced by BaseModule::BaseModule(), FastSlowCompare::FastSlowCompare(), GeSpectrum::GeSpectrum(), BaseModule::GetDirectory(), MakeMuonEvents::MakeMuonEvents(), and PlotAmpVsTDiff::PlotAmpVsTDiff().

Definition at line 67 of file PlotIntegralRatios.h.

Referenced by PlotIntegralRatios(), and ProcessEntry().

Definition at line 67 of file PlotIntegralRatios.h.

Referenced by PlotIntegralRatios().

Definition at line 66 of file PlotIntegralRatios.h.

Referenced by BeforeFirstEntry().

Definition at line 65 of file PlotIntegralRatios.h.

Referenced by BeforeFirstEntry(), and ProcessEntry().


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

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1