TMEViewer Class Reference
[Modules]

Testing the TMEs for my Al50 analysis. More...

#include <TMEViewer.h>

Inheritance diagram for TMEViewer:
BaseModule

List of all members.

Public Member Functions

 TMEViewer (modules::options *opts)
 Constructor description. If necessary, add a details tag like above.
 ~TMEViewer ()
 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< IDs::channelDetectorList

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

long int fNullCount
long int fTdpCount
bool fQuit
DetectorList fDetectors
TCanvas * fCanvas
TApplication * fApp
TH2F * fTDiffPerDetector

Detailed Description

Testing the TMEs for my Al50 analysis.

Author:
Andrew Edmonds

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 28 of file TMEViewer.h.


Member Typedef Documentation

typedef std::vector<IDs::channel> TMEViewer::DetectorList [private]

Definition at line 64 of file TMEViewer.h.


Constructor & Destructor Documentation

TMEViewer::TMEViewer ( 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 21 of file TMEViewer.cpp.

00021                                         :
00022    BaseModule("TMEViewer",opts),fNullCount(0),fTdpCount(0){
00023 }

TMEViewer::~TMEViewer (  ) 

Is anything done in the destructor?

Definition at line 25 of file TMEViewer.cpp.

00025                      {
00026 }


Member Function Documentation

int TMEViewer::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 158 of file TMEViewer.cpp.

00158                                                                        {
00159 
00160   return 0;
00161 }

int TMEViewer::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 28 of file TMEViewer.cpp.

References fApp, fCanvas, fDetectors, fQuit, fTDiffPerDetector, IDs::kMuSc, IDs::kNotApplicable, IDs::kSiL1_1, IDs::kSiL1_2, IDs::kSiL1_3, IDs::kSiL1_4, IDs::kSiL2, IDs::kSiR1_1, IDs::kSiR1_2, IDs::kSiR1_3, IDs::kSiR1_4, and IDs::kSiR2.

00028                                                                          {
00029     using namespace IDs;
00030     fDetectors.push_back(IDs::channel (kSiL1_1 , kNotApplicable ));
00031     fDetectors.push_back(IDs::channel (kSiL1_2 , kNotApplicable ));
00032     fDetectors.push_back(IDs::channel (kSiL1_3 , kNotApplicable ));
00033     fDetectors.push_back(IDs::channel (kSiL1_4 , kNotApplicable ));
00034     fDetectors.push_back(IDs::channel (kSiL2   , kNotApplicable ));
00035     fDetectors.push_back(IDs::channel (kSiR1_1 , kNotApplicable ));
00036     fDetectors.push_back(IDs::channel (kSiR1_2 , kNotApplicable ));
00037     fDetectors.push_back(IDs::channel (kSiR1_3 , kNotApplicable ));
00038     fDetectors.push_back(IDs::channel (kSiR1_4 , kNotApplicable ));
00039     fDetectors.push_back(IDs::channel (kSiR2   , kNotApplicable ));
00040     fDetectors.push_back(IDs::channel (kMuSc   , kNotApplicable ));
00041 
00042     fTDiffPerDetector=new TH2F("hTDiffPerChannel", "TDiff to muSc for each channel per TME", 
00043             5000, -1.2e4,1.2e4,fDetectors.size(),0,fDetectors.size());
00044     fTDiffPerDetector->SetXTitle("TDiff to central muon (ns)");
00045     fTDiffPerDetector->SetDrawOption("COLZ");
00046     fTDiffPerDetector->SetStats(false);
00047     for(DetectorList::const_iterator i_det=fDetectors.begin();
00048             i_det!=fDetectors.end(); ++i_det){
00049         fTDiffPerDetector->GetYaxis()->SetBinLabel(i_det-fDetectors.begin()+1, i_det->str().c_str());
00050     }
00051 
00052     fQuit = false;
00053     char** args;
00054     fApp = new TApplication("app",0,args); //  so we can see the Canvas when we draw it
00055     fCanvas = new TCanvas("fCanvas", "fCanvas");
00056   return 0;
00057 }

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 TMEViewer::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 59 of file TMEViewer.cpp.

References TDetectorPulse::CouldBePaired(), fCanvas, fDetectors, fQuit, fTDiffPerDetector, TDetectorPulse::GetTime(), gMuonEvents, and TDetectorPulse::IsPairedPulse().

00059                                                                      {
00060   // Loop over each TME
00061   MuonEventList::const_iterator i_tme = gMuonEvents.begin();
00062 
00063   std::string input;
00064   bool found_interesting_event = false;
00065   while (!fQuit || !found_interesting_event) {
00066     found_interesting_event = false;
00067     fTDiffPerDetector->Reset();
00068 
00069     // Loop through the detecotrs
00070     for(DetectorList::const_iterator i_det=fDetectors.begin();i_det!=fDetectors.end(); ++i_det){
00071 
00072       // pulses per channel
00073       int N=0, n;
00074       double tme_time= (*i_tme)->GetTime();
00075       int source_index=(*i_tme)->GetSourceIndex(*i_det);
00076       while(source_index>-1){
00077         const IDs::source& source=(*i_tme)->GetSource(source_index);
00078         n=(*i_tme)->NumPulses(source);
00079         N+=n;
00080         for(int i=0; i<n; ++i){
00081           const TDetectorPulse* tdp=(*i_tme)->GetPulse(source,i);
00082           if(tdp && (tdp->IsPairedPulse() || !tdp->CouldBePaired()) )
00083             fTDiffPerDetector->Fill(tdp->GetTime() - tme_time, i_det - fDetectors.begin());
00084         }
00085         source_index=(*i_tme)->GetSourceIndex(*i_det,source_index+1);
00086       }
00087     }
00088     if (fTDiffPerDetector->GetEntries() > 1 && !(*i_tme)->HasMuonPileup()) {
00089       std::cout << "TME #" << i_tme - gMuonEvents.begin() << std::endl;
00090       found_interesting_event = true;
00091       fTDiffPerDetector->Draw("COLZ");
00092       fCanvas->Update();
00093       
00094       std::cout << "Press any key to go to next TME (q to quit)" << std::endl;
00095       std::getline( std::cin, input);
00096       if (input == "q") {
00097         fQuit = true;
00098         break;
00099       }
00100     }
00101     std::cout << "TME #" << i_tme - gMuonEvents.begin() << std::endl;
00102     ++i_tme;
00103     if (i_tme == gMuonEvents.end() ) {
00104       std::cout << "At the end" << std::endl;
00105       break;
00106     }
00107   }
00108   /*    for(MuonEventList::const_iterator i_tme=gMuonEvents.begin();
00109             i_tme!=gMuonEvents.end(); ++i_tme){
00110 
00111       // First, check for pile-up in the muSc
00112       if ( (*i_tme)->HasMuonPileup()) {
00113         continue;
00114       }
00115 
00116       double tme_time= (*i_tme)->GetTime(); // this is the same as the muSc time
00117   */
00118       /*      int source_index = (*i_tme)->GetSourceIndex(*fMuSc);
00119       const IDs::source& source=(*i_tme)->GetSource(source_index);
00120       const TDetectorPulse* muSc_tdp = (*i_tme)->GetPulse(source,0);
00121       double muSc_time = muSc_tdp->GetTime();
00122       std::cout << tme_time << " - " << muSc_time << " = " << tme_time - muSc_time << std::endl;
00123       */
00124   /*
00125       // Now loop through the SiL1
00126       for(DetectorList::const_iterator i_det=fSiL1.begin();
00127                 i_det!=fSiL1.end(); ++i_det){
00128         // pulses per channel
00129         int SiL1_source_index=(*i_tme)->GetSourceIndex(*i_det);
00130         while(SiL1_source_index>-1){
00131           const IDs::source& SiL1_source=(*i_tme)->GetSource(SiL1_source_index);
00132           
00133           int n_SiL1 = (*i_tme)->NumPulses(SiL1_source);
00134           //          std::cout << SiL1_source << " has " << n_SiL1 << " pulses" << std::endl;
00135           for(int i=0; i<n_SiL1; ++i){
00136             const TDetectorPulse* tdp=(*i_tme)->GetPulse(SiL1_source,i);
00137             double thin_amplitude = tdp->GetAmplitude();
00138 
00139             // Loop trhough the SiL2 pulses
00140             int SiL2_source_index=(*i_tme)->GetSourceIndex(*fSiL2);
00141             const IDs::source& SiL2_source=(*i_tme)->GetSource(SiL2_source_index);
00142             int n_SiL2 = (*i_tme)->NumPulses(SiL2_source);
00143             for (int j=0; j<n_SiL2; ++j) {
00144               const TDetectorPulse* tdp_SiL2=(*i_tme)->GetPulse(SiL2_source,j);
00145               double thick_amplitude = tdp_SiL2->GetAmplitude();
00146               std::cout << "(i, j) = (" << i << ", " << j << ") = " << thin_amplitude << ", " << thick_amplitude << std::endl;
00147               fAvdA_SiL->Fill(thin_amplitude, thin_amplitude+thick_amplitude);
00148             }
00149           }
00150           SiL1_source_index=(*i_tme)->GetSourceIndex(*i_det,SiL1_source_index+1);
00151         }
00152       }
00153     }
00154 */
00155   return 0;
00156 }

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

TApplication* TMEViewer::fApp [private]

Definition at line 68 of file TMEViewer.h.

Referenced by BeforeFirstEntry().

TCanvas* TMEViewer::fCanvas [private]

Definition at line 67 of file TMEViewer.h.

Referenced by BeforeFirstEntry(), and ProcessEntry().

Definition at line 65 of file TMEViewer.h.

Referenced by BeforeFirstEntry(), and ProcessEntry().

long int TMEViewer::fNullCount [private]

Definition at line 60 of file TMEViewer.h.

bool TMEViewer::fQuit [private]

Definition at line 62 of file TMEViewer.h.

Referenced by BeforeFirstEntry(), and ProcessEntry().

Definition at line 69 of file TMEViewer.h.

Referenced by BeforeFirstEntry(), and ProcessEntry().

long int TMEViewer::fTdpCount [private]

Definition at line 60 of file TMEViewer.h.


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

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1