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

Public Member Functions

 PMTcoordinates (fhicl::ParameterSet const &p)
 
 PMTcoordinates (PMTcoordinates const &)=delete
 
 PMTcoordinates (PMTcoordinates &&)=delete
 
PMTcoordinatesoperator= (PMTcoordinates const &)=delete
 
PMTcoordinatesoperator= (PMTcoordinates &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 

Private Attributes

TTree * fTree
 
int event
 
int event_type
 
int is_Neutrino
 
int Neutrino_Interaction
 
int noPMT [nPMTs]
 
int turned_PMT
 
double PMTx [nPMTs]
 
double PMTy [nPMTs]
 
double PMTz [nPMTs]
 
int Cryostat [nPMTs]
 
int TPC [nPMTs]
 
float photons_collected [nPMTs]
 
float QE_photons_collected [nPMTs]
 
float photon_time [nPMTs][MaxPhotons]
 
float firstphoton_time [nPMTs]
 
float true_barycentre_x
 
float true_barycentre_y
 
float true_barycentre_z
 
double vertex_x
 
double vertex_y
 
double vertex_z
 
float reco_barycentre_y
 
float reco_barycentre_z
 
float total_quenched_energy
 
float total_coll_photons
 
float PMT_error_y
 
float PMT_error_z
 
float PMT_total_error
 
art::InputTag photonLabel
 
art::InputTag chargeLabel
 
art::InputTag typoLabel
 

Detailed Description

Definition at line 82 of file PMTcoordinates_module.cc.

Constructor & Destructor Documentation

icarus::PMTcoordinates::PMTcoordinates ( fhicl::ParameterSet const &  p)
explicit

Definition at line 157 of file PMTcoordinates_module.cc.

158  :
159  EDAnalyzer(p),
160  photonLabel(p.get<art::InputTag>("fottoni", "largeant")),
161  chargeLabel(p.get<art::InputTag>("carconi", "largeant")),
162  typoLabel (p.get<art::InputTag>("tiponi", "generator"))
163  // More initializers here.
164 {
165  std::cout << " PMT coordinates constructor " << std::endl;
166 }
pdgs p
Definition: selectors.fcl:22
BEGIN_PROLOG could also be cout
icarus::PMTcoordinates::PMTcoordinates ( PMTcoordinates const &  )
delete
icarus::PMTcoordinates::PMTcoordinates ( PMTcoordinates &&  )
delete

Member Function Documentation

void icarus::PMTcoordinates::analyze ( art::Event const &  e)
override

Definition at line 168 of file PMTcoordinates_module.cc.

169 {
170 ////////////////////////////////// Create the LArsoft services and service handle//////////////////////////////
171 
172 art::ServiceHandle<geo::Geometry> geom;
173 
174 std::vector<sim::SimPhotons> const& optical = *(evt.getValidHandle<std::vector<sim::SimPhotons>>(photonLabel));
175 std::vector<sim::SimChannel> const& charge = *(evt.getValidHandle<std::vector<sim::SimChannel>>(chargeLabel));
176 //std::vector<simb::MCTruth> const& type = *(evt.getValidHandle<std::vector<simb::MCTruth>>(typoLabel));
177 
178 ////////////////////////////////// Event number//////////////////////////////
179 
180 event = evt.id().event();
181 
182 //std::vector< art::Handle< std::vector<simb::MCTruth> > > type;
183 //evt.getManyByType(type);
184 auto type = evt.getMany< std::vector<simb::MCTruth> >();
185 
186 for(size_t mcl = 0; mcl < type.size(); ++mcl)
187 {
188  art::Handle< std::vector<simb::MCTruth> > mclistHandle = type[mcl];
189 
190  for(size_t m = 0; m < mclistHandle->size(); ++m)
191  {
192  art::Ptr<simb::MCTruth> mct(mclistHandle, m);
193 // for(int ipart=0;ipart<mct->NParticles();ipart++)
194 // {
195 // int pdg=mct->GetParticle(ipart).PdgCode();
196 // double xx=mct->GetParticle(ipart).Vx();
197 // double yy=mct->GetParticle(ipart).Vy();
198 // double zz=mct->GetParticle(ipart).Vz();
199 
200  event_type=mct->GetParticle(0).PdgCode();
201  vertex_x=mct->GetParticle(0).Vx();
202  vertex_y=mct->GetParticle(0).Vy();
203  vertex_z=mct->GetParticle(0).Vz();
204 
205  if (event_type==12||event_type==-12||event_type==14||event_type==-14||event_type==16||event_type==-16)
206  {
207  is_Neutrino=1;
208  Neutrino_Interaction=mct->GetNeutrino().InteractionType();
209  }
210  else
211  {
212  is_Neutrino=0;
213  Neutrino_Interaction=-9999;
214  }
215 
216 // }
217  }
218 
219 }
220 
221 
222 ////////////////////////////////// Putting at 0 all the variables//////////////////////////////
223 
224 for (int g=0; g<MaxPhotons; g++)
225 {
226  for (int u=0; u<360; u++)
227  {
228  photon_time[u][g]=0;
229  }
230 }
231 
235 
237 
238 ////////////////////////////////// Charge part: identify the baricentre of the event //////////////////////////////
239 
240 for (std::size_t chargechannel = 0; chargechannel<charge.size(); ++chargechannel) //loop on SimChannel
241 {
242  auto const& channeltdcide = charge.at(chargechannel).TDCIDEMap();
243 
244  for (std::size_t TDCnu = 0; TDCnu<channeltdcide.size(); ++TDCnu) //loop on TDC
245  {
246 
247  sim::TDCIDE const& tdcide = channeltdcide.at(TDCnu);
248 
249  for (std::size_t IDEnu = 0; IDEnu<tdcide.second.size(); ++IDEnu) //loop on IDE
250  {
251  sim::IDE const& ida = tdcide.second.at(IDEnu);
252 
253 // std::cout << "IDA " << ida.x << '\t' << ida.y << '\t' << ida.z << std::endl;
254 
259 
260  } //loop on IDE
261 
262  } //loop on TDC
263 
264 }//loop on SimChannel
265 
269 
271 
272 ////////////////////////////////// Light part //////////////////////////////////////////////////
273 turned_PMT=0;
274 
277 
279 
280 for (std::size_t channel = 0; channel < optical.size(); ++channel) {
281 
282  sim::SimPhotons const& photon_vec = optical[channel];
283 
284  noPMT[channel] = channel;
285 
286  photons_collected[channel]= photon_vec.size();
287  std::cout << " channel " << channel << " photons collected " << photons_collected[channel] << std::endl;
288 // double media = photons_collected[channel]*QE;
289 
290 // QE_photons_collected[channel]= Ran.Poisson(media);
291 
292  QE_photons_collected[channel]= 0.06*photons_collected[channel];
293 
294  if (photons_collected[channel]>0){
295 
296  turned_PMT++;
297  }
298 
299  double xyz[3];
300 
301  geom->OpDetGeoFromOpChannel(channel).GetCenter(xyz);
302 
303  PMTx[channel] = xyz[0];
304  PMTy[channel] = xyz[1];
305  PMTz[channel] = xyz[2];
306 
308  reco_barycentre_z = reco_barycentre_z + PMTz[channel]*photons_collected[channel];
309  total_coll_photons= total_coll_photons + photons_collected[channel];
310  std::cout << " channel " << channel << " total photons " << total_coll_photons << std::endl;
311  firstphoton_time[channel] = 100000000;
312 
313  if (photons_collected[channel]>0)
314  {
315  for (size_t i = 0; i<photon_vec.size() && int(i)< MaxPhotons; ++i)
316  {
317  photon_time[channel][i]= photon_vec.at(i).Time;
318 
319  if (photon_time[channel][i]<firstphoton_time[channel])
320  {
321  firstphoton_time[channel]=photon_time[channel][i];
322  }
323  }
324 
325  }
326 
327 
328 // std::cout << PMTx[channel] << '\t' << PMTy[channel] << '\t' << PMTz[channel] << std::endl;
329 
330  if (PMTx[channel]<0){Cryostat[channel]=0;}
331  if (PMTx[channel]>0){Cryostat[channel]=1;}
332 
333  if (PMTx[channel]<-200){TPC[channel]=0;}
334  if (PMTx[channel]>-200 && PMTx[channel]<0){TPC[channel]=1;}
335  if (PMTx[channel]<200 && PMTx[channel]>0){TPC[channel]=2;}
336  if (PMTx[channel]>200){TPC[channel]=3;}
337 
338 }
339 
340 //total_coll_photons = total_coll_photons;
341 
342 std::cout << " fotoni finale = " <<total_coll_photons <<std::endl;
343 
346 
347 
351 
352 fTree->Fill();
353  std::cout << " after filling " << fTree << std::endl;
354 }
float photon_time[nPMTs][MaxPhotons]
float z
z position of ionization [cm]
Definition: SimChannel.h:121
unsigned int event
Definition: DataStructs.h:634
std::pair< unsigned short, std::vector< sim::IDE > > TDCIDE
List of energy deposits at the same time (on this channel)
Definition: SimChannel.h:127
BEGIN_PROLOG g
float x
x position of ionization [cm]
Definition: SimChannel.h:119
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
Ionization at a point of the TPC sensitive volume.
Definition: SimChannel.h:86
float energy
energy deposited by ionization by this track ID and time [MeV]
Definition: SimChannel.h:118
float y
y position of ionization [cm]
Definition: SimChannel.h:120
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:136
const int MaxPhotons
TCEvent evt
Definition: DataStructs.cxx:8
BEGIN_PROLOG could also be cout
void icarus::PMTcoordinates::beginJob ( )
override

Definition at line 356 of file PMTcoordinates_module.cc.

357 {
358  std::cout << " PMTcoordinates beginjob " << std::endl;
359 
360 art::ServiceHandle<art::TFileService> tfs;
361 fTree = tfs->make<TTree>("lighttree","tree for the light response");
362 
363 fTree->Branch("event",&event,"event/I");
364 fTree->Branch("event_type",&event_type,"event_type/I");
365 fTree->Branch("is_Neutrino",&is_Neutrino,"is_Neutrino/I");
366 fTree->Branch("Neutrino_Interaction",&Neutrino_Interaction,"Neutrino_Interaction/I");
367 fTree->Branch("total_quenched_energy",&total_quenched_energy,"total_quenched_energy");
368 fTree->Branch("Cryostat",&Cryostat,("Cryostat[" + std::to_string(nPMTs) + "]/I").c_str());
369 fTree->Branch("TPC",&TPC,("TPC[" + std::to_string(nPMTs) + "]/I").c_str());
370 fTree->Branch("noPMT",&noPMT,("noPMT[" + std::to_string(nPMTs) + "]/I").c_str());
371 fTree->Branch("PMTx",&PMTx,("PMTx[" + std::to_string(nPMTs) + "]/D").c_str());
372 fTree->Branch("PMTy",&PMTy,("PMTy[" + std::to_string(nPMTs) + "]/D").c_str());
373 fTree->Branch("PMTz",&PMTz,("PMTz[" + std::to_string(nPMTs) + "]/D").c_str());
374 fTree->Branch("turned_PMT",&turned_PMT,"turned_PMT/I");
375 fTree->Branch("total_coll_photons",&total_coll_photons,"total_coll_photons/F");
376 fTree->Branch("photons_colleted",&photons_collected,("photons_collected[" + std::to_string(nPMTs) + "]/F").c_str());
377 fTree->Branch("QE_photons_colleted",&QE_photons_collected,("QE_photons_collected[" + std::to_string(nPMTs) + "]/F").c_str());
378 fTree->Branch("firstphoton_time",&firstphoton_time,("firstphoton_time[" + std::to_string(nPMTs) + "]/F").c_str());
379 fTree->Branch("photon_time",&photon_time,"photon_time[360][10000]/F");
380 fTree->Branch("vertex_x",&vertex_x,"vertex_x/D");
381 fTree->Branch("vertex_y",&vertex_y,"vertex_y/D");
382 fTree->Branch("vertex_z",&vertex_z,"vertex_z/D");
383 fTree->Branch("true_barycentre_x",&true_barycentre_x,"true_barycentre_x/F");
384 fTree->Branch("true_barycentre_y",&true_barycentre_y,"true_barycentre_y/F");
385 fTree->Branch("true_barycentre_z",&true_barycentre_z,"true_barycentre_z/F");
386 fTree->Branch("reco_barycentre_y",&reco_barycentre_y,"reco_barycentre_y/F");
387 fTree->Branch("reco_barycentre_z",&reco_barycentre_z,"reco_barycentre_z/F");
388 fTree->Branch("PMT_error_y",&PMT_error_y,"PMT_error_y/F");
389 fTree->Branch("PMT_error_z",&PMT_error_z,"PMT_error_z/F");
390 fTree->Branch("PMT_total_error",&PMT_total_error,"PMT_total_error/F");
391 }
float photon_time[nPMTs][MaxPhotons]
std::string to_string(WindowPattern const &pattern)
art::ServiceHandle< art::TFileService > tfs
const int nPMTs
BEGIN_PROLOG could also be cout
PMTcoordinates& icarus::PMTcoordinates::operator= ( PMTcoordinates const &  )
delete
PMTcoordinates& icarus::PMTcoordinates::operator= ( PMTcoordinates &&  )
delete

Member Data Documentation

art::InputTag icarus::PMTcoordinates::chargeLabel
private

Definition at line 151 of file PMTcoordinates_module.cc.

int icarus::PMTcoordinates::Cryostat[nPMTs]
private

Definition at line 123 of file PMTcoordinates_module.cc.

int icarus::PMTcoordinates::event
private

Definition at line 108 of file PMTcoordinates_module.cc.

int icarus::PMTcoordinates::event_type
private

Definition at line 110 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::firstphoton_time[nPMTs]
private

Definition at line 130 of file PMTcoordinates_module.cc.

TTree* icarus::PMTcoordinates::fTree
private

Definition at line 104 of file PMTcoordinates_module.cc.

int icarus::PMTcoordinates::is_Neutrino
private

Definition at line 112 of file PMTcoordinates_module.cc.

int icarus::PMTcoordinates::Neutrino_Interaction
private

Definition at line 113 of file PMTcoordinates_module.cc.

int icarus::PMTcoordinates::noPMT[nPMTs]
private

Definition at line 115 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::photon_time[nPMTs][MaxPhotons]
private

Definition at line 128 of file PMTcoordinates_module.cc.

art::InputTag icarus::PMTcoordinates::photonLabel
private

Definition at line 150 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::photons_collected[nPMTs]
private

Definition at line 126 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::PMT_error_y
private

Definition at line 146 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::PMT_error_z
private

Definition at line 147 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::PMT_total_error
private

Definition at line 148 of file PMTcoordinates_module.cc.

double icarus::PMTcoordinates::PMTx[nPMTs]
private

Definition at line 119 of file PMTcoordinates_module.cc.

double icarus::PMTcoordinates::PMTy[nPMTs]
private

Definition at line 120 of file PMTcoordinates_module.cc.

double icarus::PMTcoordinates::PMTz[nPMTs]
private

Definition at line 121 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::QE_photons_collected[nPMTs]
private

Definition at line 127 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::reco_barycentre_y
private

Definition at line 140 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::reco_barycentre_z
private

Definition at line 141 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::total_coll_photons
private

Definition at line 144 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::total_quenched_energy
private

Definition at line 143 of file PMTcoordinates_module.cc.

int icarus::PMTcoordinates::TPC[nPMTs]
private

Definition at line 124 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::true_barycentre_x
private

Definition at line 132 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::true_barycentre_y
private

Definition at line 133 of file PMTcoordinates_module.cc.

float icarus::PMTcoordinates::true_barycentre_z
private

Definition at line 134 of file PMTcoordinates_module.cc.

int icarus::PMTcoordinates::turned_PMT
private

Definition at line 117 of file PMTcoordinates_module.cc.

art::InputTag icarus::PMTcoordinates::typoLabel
private

Definition at line 152 of file PMTcoordinates_module.cc.

double icarus::PMTcoordinates::vertex_x
private

Definition at line 136 of file PMTcoordinates_module.cc.

double icarus::PMTcoordinates::vertex_y
private

Definition at line 137 of file PMTcoordinates_module.cc.

double icarus::PMTcoordinates::vertex_z
private

Definition at line 138 of file PMTcoordinates_module.cc.


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