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

Public Member Functions

 FIFOHistogramAna (const fhicl::ParameterSet &)
 
void analyze (const art::Event &)
 

Private Attributes

std::string fInputModule
 

Detailed Description

Definition at line 31 of file FIFOHistogramAna_module.cc.

Constructor & Destructor Documentation

opdet::FIFOHistogramAna::FIFOHistogramAna ( const fhicl::ParameterSet &  pset)

Definition at line 53 of file FIFOHistogramAna_module.cc.

54  : EDAnalyzer(pset)
55  {
56  // Indicate that the Input Module comes from .fcl
57  fInputModule = pset.get<std::string>("InputModule");
58 
59  }

Member Function Documentation

void opdet::FIFOHistogramAna::analyze ( const art::Event &  evt)

Definition at line 62 of file FIFOHistogramAna_module.cc.

63  {
64 
65  art::ServiceHandle<art::TFileService> tfs;
66 
67  // Create a handle for our vector of pulses
68  art::Handle< std::vector< optdata::FIFOChannel > > FIFOChannelHandle;
69 
70  // Read in WaveformHandle
71  evt.getByLabel(fInputModule, FIFOChannelHandle);
72 
73  int Run=evt.run();
74  int EID=evt.event();
75 
76  std::stringstream FolderName;
77  FolderName.flush();
78  FolderName<<"run"<<Run<<"_evt"<<EID;
79 
80  art::TFileDirectory evtfolder = tfs->mkdir(FolderName.str().c_str());
81 
82  std::map<int, bool> ChanFolderMade;
83  std::map<uint32_t, int> ChanFolderIndex;
84  std::vector<art::TFileDirectory> ChanFolders;
85 
86 
87  for(size_t i=0; i!=FIFOChannelHandle->size(); ++i)
88  {
89  uint32_t Frame = FIFOChannelHandle->at(i).Frame();
90  uint32_t TimeSlice = FIFOChannelHandle->at(i).TimeSlice();
91  uint32_t Channel = FIFOChannelHandle->at(i).ChannelNumber();
92 
93  if(!ChanFolderMade[Channel])
94  {
95  std::stringstream ChannelLabel;
96  ChannelLabel.flush();
97  ChannelLabel<<"chan"<<Channel;
98  ChanFolderIndex[Channel] = ChanFolders.size();
99  ChanFolders.push_back(evtfolder.mkdir(ChannelLabel.str().c_str()));
100  ChanFolderMade[Channel] = true;
101  }
102 
103  std::stringstream HistName;
104  HistName.flush();
105  HistName<<"frm"<<Frame<<"_"<<"tsl"<<TimeSlice;
106 
107 
108  TH1D * ThisHist = ChanFolders[ChanFolderIndex[Channel] ].make<TH1D>(HistName.str().c_str(),HistName.str().c_str(),FIFOChannelHandle->at(i).size(), float(TimeSlice)-0.0001, float(FIFOChannelHandle->at(i).size())-0.0001+TimeSlice);
109 
110  for(size_t j=0; j!=FIFOChannelHandle->at(i).size(); ++j)
111  {
112  ThisHist->Fill(TimeSlice + j, FIFOChannelHandle->at(i).at(j));
113  }
114  }
115 
116  }
unsigned int event
Definition: DataStructs.h:634
unsigned int run
Definition: DataStructs.h:635
art::ServiceHandle< art::TFileService > tfs
TCEvent evt
Definition: DataStructs.cxx:8

Member Data Documentation

std::string opdet::FIFOHistogramAna::fInputModule
private

Definition at line 43 of file FIFOHistogramAna_module.cc.


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