IslandLength Class Reference
[Modules]

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

#include <IslandLength.h>

Inheritance diagram for IslandLength:
BaseModule

List of all members.

Public Member Functions

 IslandLength (modules::options *opts)
 Constructor description. If necessary, add a details tag like above.
 ~IslandLength ()
 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 const std::map
< std::string, std::string > 
mapSS_t
typedef mapSS_t::const_iterator mapSS_iter
typedef std::map< std::string,
TH1F * > 
mapSH_t
typedef
StringPulseIslandMap::iterator 
mapSP_iter
typedef PulseIslandList::iterator PIL_iter

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.
 IslandLength (const IslandLength &src)
 Copy C'tor is diallowed becasue i dont know what it might do.
IslandLengthoperator() (const IslandLength &rhs)
virtual void Book (TGlobalData *data, const TSetupData *setup)
 Book histograms and similar.

Private Attributes

mapSH_t fHistos
 Map of histograms, keyed by bank_name;.
mapSH_t fHistosNorm
 Map of normalised histograms, keyed by bank_name;.
TH1 * fNormHist
 The histogram that we use for normalising to;.
int fNProcessed

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 23 of file IslandLength.h.


Member Typedef Documentation

typedef std::map<std::string, TH1F*> IslandLength::mapSH_t [private]

Definition at line 64 of file IslandLength.h.

typedef StringPulseIslandMap::iterator IslandLength::mapSP_iter [private]

Definition at line 65 of file IslandLength.h.

typedef mapSS_t::const_iterator IslandLength::mapSS_iter [private]

Definition at line 63 of file IslandLength.h.

typedef const std::map<std::string, std::string> IslandLength::mapSS_t [private]

Definition at line 62 of file IslandLength.h.

typedef PulseIslandList::iterator IslandLength::PIL_iter [private]

Definition at line 66 of file IslandLength.h.


Constructor & Destructor Documentation

IslandLength::IslandLength ( 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 13 of file IslandLength.cpp.

00014   : BaseModule("IslandLength",opts)
00015 {
00016 
00017   // Do something with opts here.  Has the user specified any
00018   // particular configuration that you want to know?
00019   // For example, perhaps this module wants an axis range:
00020   //fXMax=opts->GetDouble("x_max",100); 
00021   
00022 }

IslandLength::~IslandLength (  ) 

Is anything done in the destructor?

Definition at line 26 of file IslandLength.cpp.

00027 {
00028 }

IslandLength::IslandLength ( const IslandLength src  )  [private]

Copy C'tor is diallowed becasue i dont know what it might do.


Member Function Documentation

int IslandLength::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.

Parameters:
[in] gData See BaseModule::AfterLastEntry
[in] setup See BaseModule::AfterLastEntry
Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 86 of file IslandLength.cpp.

References BaseModule::Debug(), fHistos, fHistosNorm, fNormHist, and fNProcessed.

00087 {
00088   // Return non-zero to indicate a problem
00089   if(Debug()){
00090     std::cout << "-----IslandLength::AfterLastEntry(): I'm debugging!"
00091               << std::endl;    
00092   }
00093 
00094   double run_norm = fNormHist->Integral(0,-1);
00095   for (mapSH_t::iterator it = fHistos.begin(); it != fHistos.end(); ++it){
00096     TH1F* h = it->second;
00097     TObject* obj = h->Clone((std::string(h->GetName()) + "_RunNorm").c_str());
00098     TH1* hn = static_cast<TH1*>(obj);
00099     hn->SetTitle((std::string(h->GetTitle()) + " (run normalised)").c_str());
00100     hn->Scale(1./run_norm);
00101   }
00102   for (mapSH_t::iterator it = fHistosNorm.begin(); it != fHistosNorm.end(); ++it){
00103     it->second->Scale(1./fNProcessed);
00104   }
00105 
00106   return 0;
00107 }

int IslandLength::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.

Parameters:
[in] gData See BaseModule::BeforeFirstEntry
[in] setup See BaseModule::BeforeFirstEntry
Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 32 of file IslandLength.cpp.

References Book(), BaseModule::Debug(), and fNProcessed.

00033 {
00034   // Called before the main event loop
00035   // Can be used to set things up, like histograms etc
00036   // Return non-zero to indicate a problem
00037 
00038   // Print extra info if we're debugging this module:
00039   if(Debug()){
00040     std::cout<<"-----IslandLength::BeforeFirstEntry(): I'm debugging!"
00041              <<std::endl;
00042   }
00043 
00044   fNProcessed = 0;
00045   Book(data, setup);
00046   return 0;
00047 }

void IslandLength::Book ( TGlobalData data,
const TSetupData setup 
) [private, virtual]

Book histograms and similar.

Definition at line 110 of file IslandLength.cpp.

References fHistos, fHistosNorm, fNormHist, TGlobalData::fPulseIslandToChannelMap, and TSetupData::GetDetectorName().

Referenced by BeforeFirstEntry().

00111 {
00112   //Change: Use the same map as when processing entries. This should
00113   //guarentee that all histograms we try to fill also exist 
00114   StringPulseIslandMap& islands = data->fPulseIslandToChannelMap;
00115   for (mapSP_iter it = islands.begin(); it != islands.end(); ++it){
00116 
00117     std::string bank_name = it->first;
00118     std::string det_name = setup->GetDetectorName(bank_name);
00119     std::string hist_name = "hDQ_IslandLength_" + det_name + "" + bank_name;
00120     std::string hist_title = "Length of TPulseIslands in " + det_name;
00121     std::string axis_title = ";Length /samples;Number of Islands";
00122     TH1F* histo = new TH1F(hist_name.c_str(), (hist_title + axis_title).c_str(),
00123                            500, 0, 2000);
00124     fHistos[bank_name] = histo;
00125     if (det_name == "muSc") fNormHist = histo;
00126 
00127     hist_name += "_EvtNorm";
00128     hist_title += " (event normalised)";
00129     histo = new TH1F(hist_name.c_str(), (hist_title + axis_title).c_str(),
00130                      500, 0, 2000);
00131     fHistosNorm[bank_name] = histo;
00132   }
00133 }

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();};

IslandLength& IslandLength::operator() ( const IslandLength rhs  )  [private]

Copy assignment is disallowed becasue i dont know what it might do

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 IslandLength::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.

Parameters:
[in] gData See BaseModule::ProcessEntry
[in] gSetup See BaseModule::ProcessEntry
Returns:
Non-zero to indicate a problem.

Implements BaseModule.

Definition at line 51 of file IslandLength.cpp.

References banks, fHistos, fHistosNorm, fNProcessed, TGlobalData::fPulseIslandToChannelMap, and TSetupData::GetDetectorName().

00052 {
00053   ++fNProcessed;
00054 
00055   // Called once for each event in the main event loop
00056   // Return non-zero to indicate a problem and terminate the event loop
00057   StringPulseIslandMap& banks = data->fPulseIslandToChannelMap;
00058   //typedef StringPulseIslandMap::iterator mapSP_iter;
00059   int entry_norm = -1;
00060   for (mapSP_iter biter = banks.begin(); biter != banks.end(); ++biter){
00061     std::string det_name = setup->GetDetectorName(biter->first);
00062     if (det_name == "muSc"){
00063       entry_norm = biter->second.size();
00064     }
00065   }  
00066   for (mapSP_iter biter = banks.begin(); biter != banks.end(); ++biter){
00067     std::string bank_name = biter->first;
00068     std::string det_name = setup->GetDetectorName(bank_name);
00069     PulseIslandList& islands = biter->second;
00070     
00071     TH1F* hist = fHistos.find(bank_name)->second;
00072     TH1F* histNorm = fHistosNorm.find(bank_name)->second;
00073    
00074     for (PIL_iter piter = islands.begin(); piter != islands.end(); ++piter){
00075       int length = (*piter)->GetSamples().size();
00076       hist->Fill(length);
00077       if (entry_norm!=0) histNorm->Fill(length, 1./entry_norm);
00078     }
00079   }
00080 
00081   return 0;
00082 }

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

Map of histograms, keyed by bank_name;.

Definition at line 80 of file IslandLength.h.

Referenced by AfterLastEntry(), Book(), and ProcessEntry().

Map of normalised histograms, keyed by bank_name;.

Definition at line 83 of file IslandLength.h.

Referenced by AfterLastEntry(), Book(), and ProcessEntry().

TH1* IslandLength::fNormHist [private]

The histogram that we use for normalising to;.

Definition at line 86 of file IslandLength.h.

Referenced by AfterLastEntry(), and Book().

Definition at line 89 of file IslandLength.h.

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