MyModule Class Reference

#include <MyModule.h>

Inheritance diagram for MyModule:
BaseModule

List of all members.

Public Member Functions

 MyModule (const char *HistogramDirectoryName)
 ~MyModule ()
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.
virtual int BeforeFirstEntry (TGlobalData *gData, const TSetupData *setup)=0
virtual int AfterLastEntry (TGlobalData *gData, const TSetupData *setup)=0
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 Member Functions

virtual int ProcessEntry (TGlobalData *gData)

Detailed Description

Definition at line 7 of file MyModule.h.


Constructor & Destructor Documentation

MyModule::MyModule ( const char *  HistogramDirectoryName  ) 

Definition at line 25 of file MyModule.cpp.

References bankHists, banks, hSamples1, hSamples2, hSamples3, and NCHAN.

00025                                                      :
00026   BaseModule(HistogramDirectoryName){
00027 
00028   // The following are the banks we want to compare in this example
00029   banks.push_back("CDG0");
00030   banks.push_back("CDG1");
00031   banks.push_back("CDG2");
00032   banks.push_back("CDG3");
00033   banks.push_back("CDG4");
00034   banks.push_back("CDG5");
00035   banks.push_back("CDG6");
00036   banks.push_back("CDG7");
00037 
00038   printf(" banks size %d \n",(int)banks.size());
00039 
00040   hSamples1 = new TH1F("hSamples1","",100,0,100);
00041   hSamples2 = new TH1F("hSamples2","",100,0,100);
00042   hSamples3 = new TH1F("hSamples3","",100,0,100);
00043 
00044   for (int i=0; i<NCHAN; i++)  bankHists[i] = new TH1F(Form("bank%d",i),"",100,0,100);
00045   
00046 }

MyModule::~MyModule (  ) 

Definition at line 48 of file MyModule.cpp.

00048                    {
00049 }


Member Function Documentation

virtual int BaseModule::AfterLastEntry ( TGlobalData gData,
const TSetupData setup 
) [pure virtual, inherited]
virtual int BaseModule::BeforeFirstEntry ( TGlobalData gData,
const TSetupData setup 
) [pure virtual, inherited]
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 MyModule::ProcessEntry ( TGlobalData gData  )  [private, virtual]

Definition at line 51 of file MyModule.cpp.

References bankHists, banks, TGlobalData::fPulseIslandToChannelMap, hSamples1, hSamples2, and hSamples3.

00051                                             {
00052   typedef StringPulseIslandMap::iterator map_iterator;
00053 
00054   //printf(" bank size %d\n ",banks.size());
00055   
00056   vector<TPulseIsland*> islands[banks.size()];
00057 
00058   for(unsigned int b1 = 0; b1 < banks.size(); ++b1){
00059     string bank = banks.at(b1);
00060     for(map_iterator iter = gData->fPulseIslandToChannelMap.begin(); iter != gData->fPulseIslandToChannelMap.end(); iter++){
00061 
00062       if(strcmp((iter->first).data(), bank.data()) == 0){
00063             islands[b1] = iter->second;
00064         //std::cout<<" match! iter->first: "<<iter->first<<std::endl;//printf(" iter->first = %s\n",iter->first);
00065       }  
00066     }
00067     //printf(" b1 %d, island size %d\n",b1,islands[b1].size());
00068     //hBankSize->Fill(islands[b1].size(), b1+1);
00069   }
00070 
00071   int maxTPIsize = 10;
00072 
00073   vector<int> samples[banks.size()][maxTPIsize];
00074 
00075   for (unsigned int b1=0; b1<banks.size(); b1++){
00076     for (unsigned int i=0; i<islands[b1].size(); i++){
00077       samples[b1][i] = islands[b1][i]->GetSamples();
00078     }
00079   }
00080 
00081   //for (int j=0; j<banks.size(); j++) printf("islands %d size %d, sample size %d\n",j,islands[j].size(),samples[j][0].size());
00082 
00083   for(unsigned int b1 = 0; b1 < banks.size(); ++b1){
00084 
00085     //std::cout<<" b1 "<<b1<<" / "<<banks.size()<<std::endl;
00086   
00087     for(unsigned int i = 0; i < islands[b1].size(); ++i){
00088       //printf(" bank %d, island %d timestamp %d clock tick %d\n",b1,i,islands[b1][i]->GetTimeStamp(),islands[b1][i]->GetClockTickInNs());
00089       for (unsigned int j=0; j<samples[b1][i].size(); j++){
00090         bankHists[b1]->Fill(samples[b1][i][j]);
00091         if (i==0) hSamples1->Fill(samples[b1][i][j]);
00092         if (i==1) hSamples2->Fill(samples[b1][i][j]);
00093         if (i==2) hSamples3->Fill(samples[b1][i][j]);
00094         //printf(" for channel %d, island %d, adc samples #%d = %d\n",b1,i,j,samples[i][j]);
00095       }
00096     }
00097   }
00098 
00099   return 0;
00100 }

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


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

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1