All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
opdet::wvfAnaicarus Class Reference
Inheritance diagram for opdet::wvfAnaicarus:

Public Member Functions

 wvfAnaicarus (fhicl::ParameterSet const &p)
 
 wvfAnaicarus (wvfAnaicarus const &)=delete
 
 wvfAnaicarus (wvfAnaicarus &&)=delete
 
wvfAnaicarusoperator= (wvfAnaicarus const &)=delete
 
wvfAnaicarusoperator= (wvfAnaicarus &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

size_t fEvNumber
 
size_t fChNumber
 
double fSampling
 
double fStartTime
 
double fEndTime
 
std::string fInputModuleName
 
std::stringstream histname
 

Detailed Description

Definition at line 44 of file wvfAnaicarus_module.cc.

Constructor & Destructor Documentation

opdet::wvfAnaicarus::wvfAnaicarus ( fhicl::ParameterSet const &  p)
explicit

Definition at line 79 of file wvfAnaicarus_module.cc.

80  :
81  EDAnalyzer(p) // ,
82  // More initializers here.
83 {
84  fInputModuleName = p.get< std::string >("InputModule" );
85  fSampling = p.get< double >("Sampling" );
86 
87 }
pdgs p
Definition: selectors.fcl:22
opdet::wvfAnaicarus::wvfAnaicarus ( wvfAnaicarus const &  )
delete
opdet::wvfAnaicarus::wvfAnaicarus ( wvfAnaicarus &&  )
delete

Member Function Documentation

void opdet::wvfAnaicarus::analyze ( art::Event const &  e)
override

Definition at line 100 of file wvfAnaicarus_module.cc.

101 {
102  // Implementation of required member function here.
103  std::cout << "My module on event #" << e.id().event() << std::endl;
104 
105  art::ServiceHandle<art::TFileService> tfs;
106  fEvNumber = e.id().event();
107 
108  art::Handle< std::vector< raw::OpDetWaveform > > waveHandle;
109  e.getByLabel(fInputModuleName, waveHandle);
110 
111  if(!waveHandle.isValid()){
112  std::cout << Form("Did not find any G4 photons from a producer: %s", "largeant") << std::endl;
113  }
114 
115  std::cout << "Number of photon channel: " <<waveHandle->size() << std::endl;
116 // unsigned int nChannels = pmtHandle->size();
117 
118  for(auto const& wvf : (*waveHandle)){
119  fChNumber = wvf.ChannelNumber();
120  std::cout << "Photon channel: " << fChNumber << std::endl;
121 // std::stringstream histName;
122  histname.str(std::string());
123  histname << "event_" << fEvNumber
124  << "_opchannel_" <<fChNumber;
125 
126  fStartTime = wvf.TimeStamp()/1000; //in us
127  fEndTime = double(wvf.size())/fSampling + fStartTime;
128  fEndTime = fEndTime/1000; //in us
129 
130  //Create a new histogram
131  TH1D *wvfHist = tfs->make< TH1D >(histname.str().c_str(), TString::Format(";t - %f (#mus);",fStartTime), wvf.size(), fStartTime, fEndTime);
132  //if(fChNumber==0){
133 // std::copy(wvf.begin(),wvf.end(),fAmp);
134  for(unsigned int i=0; i<wvf.size();i++){
135  wvfHist->SetBinContent(i+1,(double)wvf[i]);
136 // fAmp = (double)wvf[i];
137  // std::cout << fAmp << fTime << std::endl;
138 // fWaveformTree->Fill();
139  //std::cout << wvf[i] << std::endl;
140  }
141  }
142 }
std::stringstream histname
do i e
art::ServiceHandle< art::TFileService > tfs
BEGIN_PROLOG could also be cout
void opdet::wvfAnaicarus::beginJob ( )
override

Definition at line 89 of file wvfAnaicarus_module.cc.

89  {
90 
91 // art::ServiceHandle<art::TFileService> tfs;
92 // fWaveformTree = tfs->make<TTree>("WaveformTree", "event by event info");
93 // fWaveformTree->Branch("event",&fEvNumber,"fEvNumber/I");
94 // fWaveformTree->Branch("ch",&fChNumber,"fChNumber/I");
95 // fWaveformTree->Branch("waveform",&fAmp,"fAmp/D");
96 // fWaveformTree->Branch("time",&fTime,"fTime/D");
97 }
void opdet::wvfAnaicarus::endJob ( )
override

Definition at line 145 of file wvfAnaicarus_module.cc.

145  {
146 }
wvfAnaicarus& opdet::wvfAnaicarus::operator= ( wvfAnaicarus const &  )
delete
wvfAnaicarus& opdet::wvfAnaicarus::operator= ( wvfAnaicarus &&  )
delete

Member Data Documentation

size_t opdet::wvfAnaicarus::fChNumber
private

Definition at line 66 of file wvfAnaicarus_module.cc.

double opdet::wvfAnaicarus::fEndTime
private

Definition at line 70 of file wvfAnaicarus_module.cc.

size_t opdet::wvfAnaicarus::fEvNumber
private

Definition at line 65 of file wvfAnaicarus_module.cc.

std::string opdet::wvfAnaicarus::fInputModuleName
private

Definition at line 73 of file wvfAnaicarus_module.cc.

double opdet::wvfAnaicarus::fSampling
private

Definition at line 67 of file wvfAnaicarus_module.cc.

double opdet::wvfAnaicarus::fStartTime
private

Definition at line 69 of file wvfAnaicarus_module.cc.

std::stringstream opdet::wvfAnaicarus::histname
private

Definition at line 74 of file wvfAnaicarus_module.cc.


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