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

Public Member Functions

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

Private Attributes

std::vector< std::string > fInputModule
 
std::unique_ptr< opdet::PDMapAlgfPDSMapPtr
 
std::vector< std::string > fPMTMapLabel
 
std::vector< std::string > fArapucaMapLabel
 
std::vector< int > fNOpDetAll
 
std::vector< int > fNOpDetDirect
 
std::vector< int > fNOpDetReflected
 
TTree * fAllPhotonsTree
 
TTree * fTheOpDetTree
 
TTree * fTheEventTree
 
int fEventID
 
int fOpChannel
 
float fWavelength
 
float fTime
 
int fCountOpDetAll
 
int fCountOpDetDirect
 
int fCountOpDetReflected
 
float fOpDetX
 
float fOpDetY
 
float fOpDetZ
 
bool fisPMT
 
int fCountEventAll
 
int fCountEventDirect
 
int fCountEventReflected
 
int fVerbosity
 

Static Private Attributes

static constexpr double kVUVWavelength = 128.0
 Value used when a typical ultraviolet light wavelength is needed. More...
 
static constexpr double kVisibleWavelength = 450.0
 Value used when a typical visible light wavelength is needed. More...
 

Detailed Description

Definition at line 39 of file OpDetAnalyzer_module.cc.

Constructor & Destructor Documentation

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

Definition at line 100 of file OpDetAnalyzer_module.cc.

101  : EDAnalyzer{pset},
102  fPDSMapPtr{art::make_tool<opdet::PDMapAlg>(pset.get<fhicl::ParameterSet>("PDSMapTool"))}
103 {
104 
105  fVerbosity = pset.get<int>("Verbosity");
106 
107  try
108  {
109  fInputModule = pset.get<std::vector<std::string>>("InputModule");
110  }
111  catch(...)
112  {
113  fInputModule.push_back(pset.get<std::string>("InputModule"));
114  }
115 }
std::unique_ptr< opdet::PDMapAlg > fPDSMapPtr
std::vector< std::string > fInputModule
opdet::OpDetAnalyzer::OpDetAnalyzer ( OpDetAnalyzer const &  )
delete
opdet::OpDetAnalyzer::OpDetAnalyzer ( OpDetAnalyzer &&  )
delete

Member Function Documentation

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

Definition at line 150 of file OpDetAnalyzer_module.cc.

151 {
152 
153  // geometry information
154  art::ServiceHandle<geo::Geometry> geo;
155 
156  // get event number
157  fEventID = evt.id().event();
158 
159  // adapted from standard SimPhotonCounter code
160 
161  // Get *ALL* SimPhotonsCollection from Event
162  auto photon_handles = evt.getMany<std::vector<sim::SimPhotonsLite>>();
163  if (photon_handles.size() == 0)
164  throw art::Exception(art::errors::ProductNotFound)<<"sim SimPhotons retrieved and you requested them.";
165 
166  // reset counters
167  // event
168  fCountEventAll=0;
171  // opdet
172  fCountOpDetAll=0;
175 
176  // reset vectors
177  fNOpDetAll.clear(); fNOpDetAll.resize(geo->NOpChannels(), 0);
178  fNOpDetDirect.clear(); fNOpDetDirect.resize(geo->NOpChannels(), 0);
179  fNOpDetReflected.clear(); fNOpDetReflected.resize(geo->NOpChannels(), 0);
180 
181  // Get SimPhotonsLite from Event
182  for(auto const& mod : fInputModule){
183 
184  // Loop over direct/reflected photons
185  for (auto const& ph_handle: photon_handles) {
186  // Do some checking before we proceed
187  if (!ph_handle.isValid()) continue;
188  if (ph_handle.provenance()->moduleLabel() != mod) continue; //not the most efficient way of doing this, but preserves the logic of the module. Andrzej
189 
190  bool Reflected = (ph_handle.provenance()->productInstanceName() == "Reflected");
191 
192  if(fVerbosity > 0) std::cout<<"Found OpDet hit collection of size "<< (*ph_handle).size()<<std::endl;
193 
194  if((*ph_handle).size()>0)
195  {
196 
197  for ( auto const& photon : (*ph_handle) )
198  {
199  //Get data from HitCollection entry
200  fOpChannel=photon.OpChannel;
201  std::map<int, int> PhotonsMap = photon.DetectedPhotons;
202 
203  // do not save if PD is not sensitive to this light
204  std::string pd_type=fPDSMapPtr->pdType(fOpChannel);
205  if (Reflected && pd_type=="xarapuca_vuv") continue;
206  if(!Reflected && (pd_type=="xarapuca_vis" || pd_type=="pmt_uncoated")) continue;
207 
208  for(auto it = PhotonsMap.begin(); it!= PhotonsMap.end(); it++)
209  {
210 
211  // Calculate wavelength in nm
212  if (Reflected) fWavelength = kVisibleWavelength;
214 
215  // Get arrival time from phot
216  fTime= it->first;
217 
218  for(int i = 0; i < it->second ; i++)
219  {
220  // Increment per OpDet counters and fill all photon tree
221  fCountOpDetAll++;
222  fAllPhotonsTree->Fill();
223 
224  // all
226 
227  // direct light
228  if (!Reflected){
230  }
231  // reflected light
232  else if (Reflected) {
234  }
235  }
236  }
237  } // eng loop over photons
238  }
239  } // end loop over photon handles
240  } // end loop over input modules
241 
242 
243  // fill information in perOpDet and perEvent trees
244  for (unsigned int OpDet = 0; OpDet < geo->NOpChannels(); OpDet++) {
245 
246  // perOpDet tree
247  fOpChannel = OpDet;
248  geo::Point_t OpDetCenter = geo->OpDetGeoFromOpDet(OpDet).GetCenter();
249  fOpDetX = OpDetCenter.X();
250  fOpDetY = OpDetCenter.Y();
251  fOpDetZ = OpDetCenter.Z();
252  fisPMT = geo->OpDetGeoFromOpDet(OpDet).isSphere();
253  fCountOpDetAll = fNOpDetAll[OpDet];
256  fTheOpDetTree->Fill();
257 
258  // increment counters for perEvent tree
262 
263  if(fVerbosity >2) std::cout<<"OpDetResponseInterface PerOpDet : Event "<<fEventID<<" OpDet " << fOpChannel << " All " << fCountOpDetAll << " Dir " <<fCountOpDetDirect << ", Refl " << fCountOpDetReflected<<std::endl;
264  }
265 
266  // perEvent tree
267  fTheEventTree->Fill();
268 
269  if(fVerbosity >1) std::cout<<"OpDetResponseInterface PerEvent : Event "<<fEventID<<" All " << fCountEventAll << " Dir " <<fCountEventDirect << ", Refl " << fCountEventReflected <<std::endl;
270 
271 }
process_name can override from command line with o or output photon
Definition: runPID.fcl:28
unsigned int event
Definition: DataStructs.h:634
std::unique_ptr< opdet::PDMapAlg > fPDSMapPtr
std::vector< int > fNOpDetAll
std::vector< int > fNOpDetReflected
static constexpr double kVUVWavelength
Value used when a typical ultraviolet light wavelength is needed.
static constexpr double kVisibleWavelength
Value used when a typical visible light wavelength is needed.
std::vector< int > fNOpDetDirect
TCEvent evt
Definition: DataStructs.cxx:8
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
std::vector< std::string > fInputModule
BEGIN_PROLOG could also be cout
void opdet::OpDetAnalyzer::beginJob ( )
override

Definition at line 117 of file OpDetAnalyzer_module.cc.

118 {
119  // create output trees
120  art::ServiceHandle<art::TFileService> tfs;
121 
122  // all photons tree
123  fAllPhotonsTree = tfs->make<TTree>("AllPhotons", "AllPhotons");
124  fAllPhotonsTree->Branch("EventID", &fEventID, "EventID/I");
125  fAllPhotonsTree->Branch("Wavelength", &fWavelength, "Wavelength/F");
126  fAllPhotonsTree->Branch("OpChannel", &fOpChannel, "OpChannel/I");
127  fAllPhotonsTree->Branch("Time", &fTime, "Time/F");
128 
129  // photons per opdet tree
130  fTheOpDetTree = tfs->make<TTree>("PhotonsPerOpDet","PhotonsPerOpDet");
131  fTheOpDetTree->Branch("EventID", &fEventID, "EventID/I");
132  fTheOpDetTree->Branch("OpChannel", &fOpChannel, "OpChannel/I");
133  fTheOpDetTree->Branch("OpDetX", &fOpDetX, "OpDetX/F");
134  fTheOpDetTree->Branch("OpDetY", &fOpDetY, "OpDetY/F");
135  fTheOpDetTree->Branch("OpDetZ", &fOpDetZ, "OpDetZ/F");
136  fTheOpDetTree->Branch("isPMT", &fisPMT);
137  fTheOpDetTree->Branch("CountAll", &fCountOpDetAll, "CountAll/I");
138  fTheOpDetTree->Branch("CountDirect", &fCountOpDetDirect, "CountDirect/I");
139  fTheOpDetTree->Branch("CountReflected", &fCountOpDetReflected, "CountReflected/I");
140 
141  // photons per event tree
142  fTheEventTree = tfs->make<TTree>("PhotonsPerEvent","PhotonsPerEvent");
143  fTheEventTree->Branch("EventID", &fEventID, "EventID/I");
144  fTheEventTree->Branch("CountAll", &fCountEventAll, "CountAll/I");
145  fTheEventTree->Branch("CountDirect", &fCountEventDirect, "CountDirect/I");
146  fTheEventTree->Branch("CountReflected", &fCountEventReflected, "CountReflected/I");
147 
148 }
art::ServiceHandle< art::TFileService > tfs
void opdet::OpDetAnalyzer::endJob ( )
override

Definition at line 273 of file OpDetAnalyzer_module.cc.

274 {
275  // Implementation of optional member function here.
276 }
OpDetAnalyzer& opdet::OpDetAnalyzer::operator= ( OpDetAnalyzer const &  )
delete
OpDetAnalyzer& opdet::OpDetAnalyzer::operator= ( OpDetAnalyzer &&  )
delete

Member Data Documentation

TTree* opdet::OpDetAnalyzer::fAllPhotonsTree
private

Definition at line 70 of file OpDetAnalyzer_module.cc.

std::vector<std::string> opdet::OpDetAnalyzer::fArapucaMapLabel
private

Definition at line 64 of file OpDetAnalyzer_module.cc.

int opdet::OpDetAnalyzer::fCountEventAll
private

Definition at line 85 of file OpDetAnalyzer_module.cc.

int opdet::OpDetAnalyzer::fCountEventDirect
private

Definition at line 86 of file OpDetAnalyzer_module.cc.

int opdet::OpDetAnalyzer::fCountEventReflected
private

Definition at line 87 of file OpDetAnalyzer_module.cc.

int opdet::OpDetAnalyzer::fCountOpDetAll
private

Definition at line 79 of file OpDetAnalyzer_module.cc.

int opdet::OpDetAnalyzer::fCountOpDetDirect
private

Definition at line 80 of file OpDetAnalyzer_module.cc.

int opdet::OpDetAnalyzer::fCountOpDetReflected
private

Definition at line 81 of file OpDetAnalyzer_module.cc.

int opdet::OpDetAnalyzer::fEventID
private

Definition at line 74 of file OpDetAnalyzer_module.cc.

std::vector<std::string> opdet::OpDetAnalyzer::fInputModule
private

Definition at line 60 of file OpDetAnalyzer_module.cc.

bool opdet::OpDetAnalyzer::fisPMT
private

Definition at line 83 of file OpDetAnalyzer_module.cc.

std::vector<int> opdet::OpDetAnalyzer::fNOpDetAll
private

Definition at line 66 of file OpDetAnalyzer_module.cc.

std::vector<int> opdet::OpDetAnalyzer::fNOpDetDirect
private

Definition at line 67 of file OpDetAnalyzer_module.cc.

std::vector<int> opdet::OpDetAnalyzer::fNOpDetReflected
private

Definition at line 68 of file OpDetAnalyzer_module.cc.

int opdet::OpDetAnalyzer::fOpChannel
private

Definition at line 75 of file OpDetAnalyzer_module.cc.

float opdet::OpDetAnalyzer::fOpDetX
private

Definition at line 82 of file OpDetAnalyzer_module.cc.

float opdet::OpDetAnalyzer::fOpDetY
private

Definition at line 82 of file OpDetAnalyzer_module.cc.

float opdet::OpDetAnalyzer::fOpDetZ
private

Definition at line 82 of file OpDetAnalyzer_module.cc.

std::unique_ptr<opdet::PDMapAlg> opdet::OpDetAnalyzer::fPDSMapPtr
private

Definition at line 63 of file OpDetAnalyzer_module.cc.

std::vector<std::string> opdet::OpDetAnalyzer::fPMTMapLabel
private

Definition at line 64 of file OpDetAnalyzer_module.cc.

TTree* opdet::OpDetAnalyzer::fTheEventTree
private

Definition at line 72 of file OpDetAnalyzer_module.cc.

TTree* opdet::OpDetAnalyzer::fTheOpDetTree
private

Definition at line 71 of file OpDetAnalyzer_module.cc.

float opdet::OpDetAnalyzer::fTime
private

Definition at line 77 of file OpDetAnalyzer_module.cc.

int opdet::OpDetAnalyzer::fVerbosity
private

Definition at line 89 of file OpDetAnalyzer_module.cc.

float opdet::OpDetAnalyzer::fWavelength
private

Definition at line 76 of file OpDetAnalyzer_module.cc.

constexpr double opdet::OpDetAnalyzer::kVisibleWavelength = 450.0
staticprivate

Value used when a typical visible light wavelength is needed.

Definition at line 95 of file OpDetAnalyzer_module.cc.

constexpr double opdet::OpDetAnalyzer::kVUVWavelength = 128.0
staticprivate

Value used when a typical ultraviolet light wavelength is needed.

Definition at line 92 of file OpDetAnalyzer_module.cc.


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