Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
zcl::FmmTrackerAna Class Reference
Inheritance diagram for zcl::FmmTrackerAna:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 FmmTrackerAna (fhicl::ParameterSet const &pset)
 
virtual ~FmmTrackerAna ()
 
void analyze (const art::Event &evt)
 
void beginJob ()
 
void endJob ()
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

double dist2 (double dx, double dy)
 
double doca2 (double x, double y, double x0, double y0, double dydx)
 
double vfit (std::vector< TVector3 > &Positions, std::vector< double > &Ts, std::vector< double > &Terr, double &v_err, double &Tmean, double &Trms, double &dTsqr)
 

Private Attributes

std::string fTrackerInput
 
const int ntrials = 100
 
const double X_err = 1.8
 
const double Y_err = 1.8
 
const double Z_err = 2.82
 
TTree * RC_Tree
 
TRandom * genR = new TRandom3()
 
int evtID
 
int subRunID
 
int RunID
 
int nxhits
 
int nyhits
 
int nhits_sat
 
double MIP_tot
 
double ADC_tot
 
double GeV_tot
 
double tns_mean
 
double tns_rms
 
double tns_min
 
double tns_max
 
int max_gap
 
int miss_plane
 
int p_cross
 
int p_overlap
 
double Xi
 
double Yi
 
double Zi
 
double Ti
 
double Xf
 
double Yf
 
double Zf
 
double Tf
 
double t_min
 
double t_max
 
double x_tmin
 
double x_tmax
 
double y_tmin
 
double y_tmax
 
double z_tmin
 
double z_tmax
 
double lxsqr
 
double lysqr
 
double vrc_sat
 
double tSat_mean
 
double tSat_rms
 
double vSat_err
 
double vrc_nonsat
 
double tnonSat_mean
 
double tnonSat_rms
 
double vnonSat_err
 
double Chisqr_TS
 
double Chisqr_TN
 
double adc_W
 
art::ServiceHandle< nova::dbi::RunHistoryServicerh_
 

Detailed Description

Definition at line 52 of file FmmTrackerAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

zcl::FmmTrackerAna::FmmTrackerAna ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 120 of file FmmTrackerAna_module.cc.

120  :
121  EDAnalyzer(p),
122  fTrackerInput (p.get< std::string > ("TrackerInput") )
123 {
124 }
const char * p
Definition: xmltok.h:285
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
enum BeamMode string
zcl::FmmTrackerAna::~FmmTrackerAna ( )
virtual

Definition at line 126 of file FmmTrackerAna_module.cc.

127 {
128  // Clean up dynamic memory and other resources here.
129 }

Member Function Documentation

void zcl::FmmTrackerAna::analyze ( const art::Event evt)

Definition at line 197 of file FmmTrackerAna_module.cc.

References rawdata::RawDigit::ADC(), ADC_tot, adc_W, rb::CellHit::Cell(), rb::Cluster::Cell(), Chisqr_TN, Chisqr_TS, om::cout, doca2(), dx, dy, allTimeWatchdog::endl, art::EventID::event(), evtID, stan::math::fabs(), fTrackerInput, geom(), art::DataViewImpl::getByLabel(), calib::Calibrator::GetTimeRes(), GeV_tot, h1, MECModelEnuComparisons::i, art::Event::id(), geo::kX, lxsqr, lysqr, Mag(), calib::Calibrator::MakeRecoHit(), std::max(), max_gap, std::min(), MIP_tot, miss_plane, rb::Cluster::NCell(), nhits_sat, nxhits, nyhits, p_cross, p_overlap, rb::CellHit::Plane(), geo::GeometryBase::Plane(), elec2geo::pos, RC_Tree, art::Event::run(), RunID, std::sqrt(), art::Event::subRun(), subRunID, t_max, t_min, Tf, Ti, tnonSat_mean, tnonSat_rms, rb::CellHit::TNS(), tns_max, tns_mean, tns_min, tns_rms, tSat_mean, tSat_rms, vfit(), rb::CellHit::View(), vnonSat_err, vrc_nonsat, vrc_sat, vSat_err, W, x_tmax, x_tmin, Xf, Xi, y_tmax, y_tmin, Yf, Yi, z_tmax, z_tmin, Zf, and Zi.

198 {
199  evtID = evt.id().event();
200  subRunID = evt.subRun();
201  RunID = evt.run();
202 
205 
206  //=====================================================================================
208  evt.getByLabel(fTrackerInput,trks);
209 
210  if (trks->size() < 1) {
211  std::cout<<"There is no track reconstructed in this event!"<<std::endl;
212  return;
213  }
214 
215  //take the entire 3D track:
216  for (unsigned trkIdx = 0; trkIdx != trks->size(); ++trkIdx ) {
217  const rb::Track& track = (*trks)[trkIdx];
218 
219  if (track.NCell()<6) continue;
220 
221  tns_mean = 0; //ADC Weighed average time
222  double ADC_sum = 0;
223 
224  //With the first round of loop, can determine the following info: t_mean
225 
226  for (unsigned i = 0; i != track.NCell(); ++i) {
227  const art::Ptr<rb::CellHit> chit = track.Cell(i);
228  double tns = chit->TNS();
229  double adc = chit->ADC();
230  tns_mean += tns*adc;
231  ADC_sum += adc;
232  }
233 
234  tns_mean /= ADC_sum;
235  //=============================================================
236 
237  //Just determine the RMS of the time:
238  tns_rms = 0;
239  for (unsigned i = 0; i != track.NCell(); ++i) {
240  const art::Ptr<rb::CellHit> chit = track.Cell(i);
241  double tns = chit->TNS();
242  double adc = chit->ADC();
243  tns_rms = (tns-tns_mean)*adc*(tns-tns_mean)*adc;
244  }
245  tns_rms = sqrt(tns_rms/ADC_sum+250000/12.);
246 
247  //==============================================================
248  //Now, loop through the hits again to throw away the hits outside the 4 sigma range,
249  //Make sure they get updated!
250  tns_min = 99999999;
251  tns_max = -99999999;
252  nxhits = 0;
253  nyhits = 0;
254  nhits_sat = 0;
255  ADC_tot = 0;
256  std::vector<int> planes;
257 
258  int P_x0=9999;
259  int P_x1=0;
260  int P_y0=9999;
261  int P_y1=0;
262 
263  for (unsigned i = 0; i != track.NCell(); ++i) {
264  const art::Ptr<rb::CellHit> chit = track.Cell(i);
265  double tns = chit->TNS();
266  if (tns > tns_mean + 4*tns_rms || tns < tns_mean - 4*tns_rms) continue;
267  if (tns > tns_max) tns_max = tns;
268  if (tns < tns_min) tns_min = tns;
269  planes.emplace_back(chit->Plane());
270  ADC_tot += chit->ADC();
271 
272  if (chit->View()==geo::kX) {
273  ++nxhits;
274  if (chit->Plane() < P_x0) P_x0 = chit->Plane();
275  if (chit->Plane() > P_x1) P_x1 = chit->Plane();
276  }
277  else {
278  ++nyhits;
279  if (chit->Plane() < P_y0) P_y0 = chit->Plane();
280  if (chit->Plane() > P_y1) P_y1 = chit->Plane();
281  }
282  }
283 
284  if (planes.size()<3) continue;
285 
286  if (P_x1-P_x0<3) continue;
287  if (P_y1-P_y0<3) continue;
288 
289  //Now calculate the missing planes and the max gap:
290  std::sort (planes.begin(), planes.end());
291  max_gap = 0;
292  miss_plane = 0;
293  p_cross = planes.back()-planes.front()+1;
294  p_overlap = 1;
295  bool start_flag = false;
296  for (unsigned pidx =0; pidx+1<planes.size(); ++pidx) {
297  int dP = planes[pidx+1] - planes[pidx] - 1;
298  //Calculate the number of planes in the overlapped region:
299  if (!start_flag) {
300  if ( (planes[pidx+1] - planes[pidx]) % 2 ) start_flag = true;
301  }
302  else {
303  if ( (planes[pidx+1] - planes[pidx]) % 2 ) ++p_overlap;
304  }
305  if (dP > 0 ) {
306  miss_plane += dP;
307  if (dP > max_gap) max_gap = dP;
308  }
309  }
310  //========================================================
311  //Loop through the hits again: this time, determine dxdz and dydz
312 
313  std::vector<double> x0s_x, x1s_x, y0s_y, y1s_y;
314  std::vector<double> x0s_z, x1s_z, y0s_z, y1s_z;
315  for (unsigned i = 0; i != track.NCell(); ++i) {
316  const art::Ptr<rb::CellHit> chit = track.Cell(i);
317  double tns = chit->TNS();
318  if (tns > tns_mean + 4*tns_rms || tns < tns_mean - 4*tns_rms) continue;
319 
320  double xyz[3];
321  geom->Plane(chit->Plane())->Cell(chit->Cell())->GetCenter(xyz);
322 
323  if (chit->Plane() == P_x0 ) {
324  x0s_x.emplace_back(xyz[0]);
325  x0s_z.emplace_back(xyz[2]);
326  }
327  if (chit->Plane() == P_x1 ) {
328  x1s_x.emplace_back(xyz[0]);
329  x1s_z.emplace_back(xyz[2]);
330  }
331 
332  if (chit->Plane() == P_y0 ) {
333  y0s_y.emplace_back(xyz[1]);
334  y0s_z.emplace_back(xyz[2]);
335  }
336  if (chit->Plane() == P_y1 ) {
337  y1s_y.emplace_back(xyz[1]);
338  y1s_z.emplace_back(xyz[2]);
339  }
340  }
341 
342  double z_x0=0;
343  double x_x0=0;
344  double z_y0=0;
345  double y_y0=0;
346  double z_x1=0;
347  double z_y1=0;
348 
349  double dx = 0;
350  double dy = 0;
351  double dxdz = 0;
352  double dydz = 0;
353 
354  for (unsigned h0 = 0; h0 != x0s_x.size(); ++h0) {
355  for (unsigned h1 = 0; h1 != x1s_x.size(); ++h1) {
356  if (fabs(dx) < fabs(x1s_x[h1]-x0s_x[h0])) {
357  dx = x1s_x[h1]-x0s_x[h0];
358  dxdz = dx/(x1s_z[h1]-x0s_z[h0]);
359  z_x0 = x0s_z[h0];
360  x_x0 = x0s_x[h0];
361  z_x1 = x1s_z[h1];
362  }
363  }
364  }
365 
366  for (unsigned h0 = 0; h0 != y0s_y.size(); ++h0) {
367  for (unsigned h1 = 0; h1 != y1s_y.size(); ++h1) {
368  if (fabs(dy) < fabs(y1s_y[h1]-y0s_y[h0])) {
369  dy = y1s_y[h1]-y0s_y[h0];
370  dydz = dy/(y1s_z[h1]-y0s_z[h0]);
371 
372  z_y0 = y0s_z[h0];
373  y_y0 = y0s_y[h0];
374  z_y1 = y1s_z[h1];
375  }
376  }
377  }
378 
379  //Now you can determine the two ends:
380  double zi = std::min(z_x0,z_y0);
381  double zf = std::max(z_x1,z_y1);
382 
383  double xi = dxdz*(zi-z_x0)+x_x0;
384  double xf = dxdz*(zf-z_x0)+x_x0;
385  double yi = dydz*(zi-z_y0)+y_y0;
386  double yf = dydz*(zf-z_y0)+y_y0;
387 
388  TVector3 Pi(xi,yi,zi); // Low Z end
389  TVector3 Pf(xf,yf,zf); // High Z end
390 
391  //Now, we know the direction of the track, can provide the W position,
392  //Loop through the hits attached to the track again!
393  MIP_tot = 0;
394  GeV_tot = 0;
395  double t_min = 9999999;
396  double t_max = -9999999;
397 
398  std::vector<double> ts_sat,terrs_sat;
399  std::vector<double> ts_unsat,terrs_unsat;
400  std::vector<TVector3> pos_sat, pos_unsat;
401 
402  lxsqr = 0;
403  lysqr = 0;
404 
405  //In the following loop, determine the ADC center from the geometry center:
406  TVector3 adc_Center(0,0,0);
407  TVector3 geo_Center(0,0,0);
408  ADC_tot = 0;
409 
410  for (unsigned i = 0; i != track.NCell(); ++i) {
411  const art::Ptr<rb::CellHit> chit = track.Cell(i);
412  double tns = chit->TNS();
413  if (tns > tns_mean + 4*tns_rms || tns < tns_mean - 4*tns_rms) continue;
414 
415  //Interpolate the W position:
416  double W;
417  double xyz[3];
418  geom->Plane(chit->Plane())->Cell(chit->Cell())->GetCenter(xyz);
419 
420  if (chit->View()==geo::kX) {
421  W = dydz*(xyz[2]-z_y0)+y_y0;
422  lxsqr += doca2(xyz[2],xyz[0],z_x0,x_x0, dxdz);
423  // std::cout<<"lxsqr: "<<lxsqr<<std::endl;
424  }
425  else {
426  W = dxdz*(xyz[2]-z_x0)+x_x0;
427  lysqr += doca2(xyz[2],xyz[1],z_y0,y_y0, dydz);
428  // std::cout<<"lysqr: "<<lysqr<<std::endl;
429  }
430 
431  rb::RecoHit rhit(calib->MakeRecoHit(*chit,W));
432 
433  if (!rhit.IsCalibrated()) continue;
434 
435  MIP_tot += rhit.MIP();
436  GeV_tot += rhit.GeV();
437 
438  TVector3 pos(rhit.X(), rhit.Y(), rhit.Z());
439 
440  adc_Center += (chit->ADC())*pos;
441  geo_Center += pos;
442  ADC_tot += chit->ADC();
443 
444  double st = calib->GetTimeRes(*chit);
445 
446  if (chit->ADC(3) == 4095) {
447  pos_sat.emplace_back(pos-Pi);
448  ts_sat.emplace_back(rhit.T()-tns_min);
449  terrs_sat.emplace_back(st);
450  }
451 
452  else {
453  pos_unsat.emplace_back(pos-Pi);
454  ts_unsat.emplace_back(rhit.T()-tns_min);
455  terrs_unsat.emplace_back(st);
456  }
457 
458  if (rhit.T() < t_min ) {
459  x_tmin = rhit.X();
460  y_tmin = rhit.Y();
461  z_tmin = rhit.Z();
462  t_min = rhit.T();
463  }
464 
465  if (rhit.T() > t_max ) {
466  x_tmax = rhit.X();
467  y_tmax = rhit.Y();
468  z_tmax = rhit.Z();
469  t_max = rhit.T();
470  }
471  }
472 
473  adc_Center = adc_Center*(1/double(ADC_tot));
474  geo_Center = geo_Center*(1/double(ts_sat.size()+ts_unsat.size()));
475 
476  adc_W = (adc_Center-geo_Center).Mag();
477 
478  lxsqr /= double(nxhits);
479  lysqr /= double(nyhits);
480  nhits_sat = pos_sat.size();
481 
482 
483  // std::cout<<"final lxsqr: "<<lxsqr<<" final lysqr: "<<lysqr<<std::endl;
484 
485  if (nhits_sat > 1) {
486  vrc_sat = vfit(pos_sat, ts_sat, terrs_sat, vSat_err, tSat_mean, tSat_rms,Chisqr_TS);
487  }
488 
489  else {
490  //Make them apparently invalid
491  vrc_sat = 60;
492  vSat_err = -1;
493  tSat_rms = -1;
494  tSat_mean = -1e6;
495  }
496 
497  if (pos_unsat.size() > 1) {
498  vrc_nonsat = vfit(pos_unsat, ts_unsat, terrs_unsat, vnonSat_err, tnonSat_mean, tnonSat_rms,Chisqr_TN);
499  }
500 
501  else {
502  //Make them apparently invalid
503  vrc_nonsat = 60;
504  vnonSat_err = -1;
505  tnonSat_rms = -1;
506  }
507 
508  //Just set the lowZ end to be the starting point:
509  Xi = xi;
510  Yi = yi;
511  Zi = zi;
512  Ti = t_min;
513  Xf = xf;
514  Yf = yf;
515  Zf = zf;
516  Tf = t_max;
517 
518  RC_Tree->Fill();
519  }
520 
521 } //end analyzing
float TNS() const
Definition: CellHit.h:46
T max(const caf::Proxy< T > &a, T b)
SubRunNumber_t subRun() const
Definition: Event.h:72
double GetTimeRes(rb::CellHit const &cellhit)
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
unsigned short Plane() const
Definition: CellHit.h:39
geo::View_t View() const
Definition: CellHit.h:41
T sqrt(T number)
Definition: d0nt_math.hpp:156
Vertical planes which measure X.
Definition: PlaneGeo.h:28
rb::RecoHit MakeRecoHit(rb::CellHit const &cellhit, double w)
Definition: event.h:19
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
const PlaneGeo * Plane(unsigned int i) const
Calibrated quantities relying on position in the orthogonal view. To generate a rb::CellHit from a rb...
Definition: RecoHit.h:19
unsigned short Cell() const
Definition: CellHit.h:40
CDPStorage service.
double dy[NP][NC]
double dx[NP][NC]
OStream cout
Definition: OStream.cxx:6
EventNumber_t event() const
Definition: EventID.h:116
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
TH1F * h1
double vfit(std::vector< TVector3 > &Positions, std::vector< double > &Ts, std::vector< double > &Terr, double &v_err, double &Tmean, double &Trms, double &dTsqr)
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
double doca2(double x, double y, double x0, double y0, double dydx)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void geom(int which=0)
Definition: geom.C:163
float Mag() const
T min(const caf::Proxy< T > &a, T b)
RunNumber_t run() const
Definition: Event.h:77
#define W(x)
EventID id() const
Definition: Event.h:56
void zcl::FmmTrackerAna::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 131 of file FmmTrackerAna_module.cc.

References ADC_tot, adc_W, Chisqr_TN, Chisqr_TS, evtID, GeV_tot, lxsqr, lysqr, art::TFileDirectory::make(), max_gap, MIP_tot, miss_plane, nhits_sat, nxhits, nyhits, p_cross, p_overlap, RC_Tree, RunID, subRunID, t_max, t_min, Tf, Ti, tnonSat_mean, tnonSat_rms, tns_max, tns_mean, tns_min, tns_rms, tSat_mean, tSat_rms, vnonSat_err, vrc_nonsat, vrc_sat, vSat_err, x_tmax, x_tmin, Xf, Xi, y_tmax, y_tmin, Yf, Yi, z_tmax, z_tmin, Zf, and Zi.

132 {
134 
135  //Combining cheater info and the RC info to make the data structure better
136  //One RC track info per entry, if no tracks reconstructed in this event, fill in 1 entry anyway tagging the
137  //reconstruction failed
138  RC_Tree = tfs->make<TTree>("RC_Tree","Information from RC track info");
139  RC_Tree -> Branch("event", &evtID, "event/I");
140  RC_Tree -> Branch("subRun", &subRunID, "subRun/I");
141  RC_Tree -> Branch("Run", &RunID, "Run/I");
142  RC_Tree -> Branch("nxhits", &nxhits, "nxhits/I");
143  RC_Tree -> Branch("nyhits", &nyhits, "nyhits/I");
144  RC_Tree -> Branch("nhits_sat", &nhits_sat, "nhits_sat/I");
145  RC_Tree -> Branch("MIP_tot", &MIP_tot, "MIP_tot/D");
146  RC_Tree -> Branch("ADC_tot", &ADC_tot, "ADC_tot/D");
147  RC_Tree -> Branch("GeV_tot", &GeV_tot, "GeV_tot/D");
148 
149  //Missing Planes and the max gap:
150  RC_Tree -> Branch("max_gap", &max_gap, "max_gap/I");
151  RC_Tree -> Branch("miss_plane", &miss_plane, "miss_plane/I");
152  RC_Tree -> Branch("p_cross", &p_cross, "p_cross/I");
153  RC_Tree -> Branch("p_overlap", &p_overlap, "p_overlap/I");
154 
155  RC_Tree -> Branch("Xi", &Xi, "Xi/D");
156  RC_Tree -> Branch("Xf", &Xf, "Xf/D");
157  RC_Tree -> Branch("Yi", &Yi, "Yi/D");
158  RC_Tree -> Branch("Yf", &Yf, "Yf/D");
159  RC_Tree -> Branch("Zi", &Zi, "Zi/D");
160  RC_Tree -> Branch("Zf", &Zf, "Zf/D");
161  RC_Tree -> Branch("Ti", &Ti, "Ti/D");
162  RC_Tree -> Branch("Tf", &Tf, "Tf/D");
163 
164  RC_Tree -> Branch("tns_mean", &tns_mean, "tns_mean/D");
165  RC_Tree -> Branch("tns_rms", &tns_rms, "tns_rms/D");
166  RC_Tree -> Branch("tns_min", &tns_min, "tns_min/D");
167  RC_Tree -> Branch("tns_max", &tns_max, "tns_max/D");
168 
169  //This is double checking the velocity check:
170  RC_Tree -> Branch("t_min", &t_min, "t_min/D");
171  RC_Tree -> Branch("t_max", &t_max, "t_max/D");
172  RC_Tree -> Branch("x_tmin", &x_tmin, "x_tmin/D");
173  RC_Tree -> Branch("x_tmax", &x_tmax, "x_tmax/D");
174  RC_Tree -> Branch("y_tmin", &y_tmin, "y_tmin/D");
175  RC_Tree -> Branch("y_tmax", &y_tmax, "y_tmax/D");
176  RC_Tree -> Branch("z_tmin", &z_tmin, "z_tmin/D");
177  RC_Tree -> Branch("z_tmax", &z_tmax, "z_tmax/D");
178 
179  //fitting parameters:
180  RC_Tree -> Branch("lxsqr", &lxsqr, "lxsqr/D");
181  RC_Tree -> Branch("lysqr", &lysqr, "lysqr/D");
182 
183  RC_Tree -> Branch("vrc_sat", &vrc_sat, "vrc_sat/D");
184  RC_Tree -> Branch("tSat_mean", &tSat_mean,"tSat_mean/D");
185  RC_Tree -> Branch("tSat_rms", &tSat_rms, "tSat_rms/D");
186  RC_Tree -> Branch("vSat_err", &vSat_err, "vsat_err/D");
187  RC_Tree -> Branch("vrc_nonsat", &vrc_nonsat, "vrc_nonsat/D");
188  RC_Tree -> Branch("tnonSat_mean", &tnonSat_mean,"tnonSat_mean/D");
189  RC_Tree -> Branch("tnonSat_rms", &tnonSat_rms, "tnonSat_rms/D");
190  RC_Tree -> Branch("vnonSat_err", &vnonSat_err, "vnonSat_err/D");
191  RC_Tree -> Branch("Chisqr_TS", &Chisqr_TS, "Chisqr_TS/D");
192  RC_Tree -> Branch("Chisqr_TN", &Chisqr_TN, "Chisqr_TN/D");
193 
194  RC_Tree -> Branch("adc_W", &adc_W, "adc_W/D");
195 }
T * make(ARGS...args) const
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDAnalyzer::currentContext ( ) const
protectedinherited
double zcl::FmmTrackerAna::dist2 ( double  dx,
double  dy 
)
private

Definition at line 523 of file FmmTrackerAna_module.cc.

References dy.

Referenced by doca2().

523  {
524  return dx*dx+dy*dy;
525 }
double dy[NP][NC]
double dx[NP][NC]
double zcl::FmmTrackerAna::doca2 ( double  x,
double  y,
double  x0,
double  y0,
double  dydx 
)
private

Definition at line 527 of file FmmTrackerAna_module.cc.

References dist2(), and stan::math::fabs().

Referenced by analyze().

528 {
529  if (fabs(x-x0) < 0.1 && fabs(y-y0)<0.1) return 0;
530  double cos2 = (x-x0 + dydx*(y-y0))*(x-x0 + dydx*(y-y0))/dist2(x-x0,y-y0)/dist2(1,dydx);
531  if (cos2==1) return (y-y0)*(y-y0);
532  double docasqr = dist2(x-x0,y-y0)*(1-cos2);
533  /*
534  std::cout<<"x: "<<x<<" y: "<<y<<" x0: "<<x0<<" y0: "<<y0
535  <<" dydx: "<<dydx<<" cos2: "<<cos2<<" docasqr: "<<docasqr<<std::endl;
536  */
537  return docasqr;
538 }
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
double dist2(double dx, double dy)
void zcl::FmmTrackerAna::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 628 of file FmmTrackerAna_module.cc.

References om::cout, DEFINE_ART_MODULE(), nova::dbi::RunHistory::GetBNEVBList(), file_size_ana::node, file_size_ana::nodes, and rh_.

628  {
629  auto nodes = rh_->GetBNEVBList();
630  for (auto node : nodes){
631  std::cout<<node.appname<<" ";
632  }
633 }
std::vector< BNEVB > GetBNEVBList()
Definition: RunHistory.h:398
dictionary nodes
art::ServiceHandle< nova::dbi::RunHistoryService > rh_
OStream cout
Definition: OStream.cxx:6
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:35
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
double zcl::FmmTrackerAna::vfit ( std::vector< TVector3 > &  Positions,
std::vector< double > &  Ts,
std::vector< double > &  Terr,
double &  v_err,
double &  Tmean,
double &  Trms,
double &  dTsqr 
)
private

Definition at line 540 of file FmmTrackerAna_module.cc.

References genR, MECModelEnuComparisons::i, calib::j, m, Mag(), ntrials, std::sqrt(), confusionMatrixTree::t, getGoodRuns4SAM::t0, registry_explorer::v, X, X_err, Y, Y_err, Z, and Z_err.

Referenced by analyze().

547 {
548  int m = Ts.size();
549  double sumL = 0;
550  double sumT = 0;
551  double sumLT = 0;
552  double sumLL = 0;
553 
554  std::vector<double> Vs;
555 
556  for (int i = 0; i!=m; ++i ) {
557  sumL += Positions[i].Mag();
558  sumT += Ts[i];
559  sumLT += Positions[i].Mag() * Ts[i];
560  sumLL += Positions[i].Mag() * Positions[i].Mag();
561  }
562 
563  Tmean = sumT/double(m);
564  double v = (sumL*sumL-m*sumLL)/(sumT*sumL-m*sumLT);
565 
566  Vs.emplace_back(v);
567 
568  for (int t = 0; t!=ntrials; ++t) {
569  sumL = 0;
570  sumT = 0;
571  sumLT = 0;
572  sumLL = 0;
573  for (int i = 0; i!=m; ++i ) {
574  double xi = genR->Uniform(Positions[i].X()-X_err,Positions[i].X()+X_err);
575  double yi = genR->Uniform(Positions[i].Y()-Y_err,Positions[i].Y()+Y_err);
576  double zi = genR->Uniform(Positions[i].Z()-Z_err,Positions[i].Z()+Z_err);
577  double ti = genR->Gaus(Ts[i], Terr[i]);
578  double li = sqrt(xi*xi+yi*yi+zi*zi);
579 
580  sumL += li;
581  sumT += ti;
582  sumLT += li*ti;
583  sumLL += li*li;
584  }
585  v = (sumL*sumL-m*sumLL)/(sumT*sumL-m*sumLT);
586 
587  Vs.emplace_back(v);
588  }
589 
590  //Calculate the mean of v, and standard error:
591 
592  double v_mean = 0;
593  v_err = 0;
594 
595  for (unsigned j = 0; j!=Vs.size(); ++j)
596  v_mean += Vs[j];
597  v_mean /= double(Vs.size());
598 
599  for (unsigned j = 0; j!=Vs.size(); ++j)
600  v_err += (Vs[j]-v_mean)*(Vs[j]-v_mean);
601 
602  v_err = sqrt(v_err)/double(Vs.size());
603 
604  if (v_mean < 0.003 && v_mean > 0)
605  v_mean = 0.003;
606 
607  else if (v_mean > -0.003 && v_mean < 0)
608  v_mean = -0.003;
609 
610  if (v_mean > 30) v_mean = 30;
611  if (v_mean <-30) v_mean = -30;
612 
613  double t0 = Tmean-sumL/(m+0.)/v_mean;
614 
615  Trms = 0;
616  dTsqr = 0;
617 
618  for (int i = 0; i!=m; ++i ) {
619  Trms += (Ts[i]-Tmean)*(Ts[i]-Tmean);
620  dTsqr+= (Ts[i]-t0-Positions[i].Mag()/v_mean)* (Ts[i]-t0-Positions[i].Mag()/v_mean);
621  }
622 
623  Trms = sqrt(Trms/(m+0.));
624  dTsqr = sqrt(dTsqr/(m+0.));
625  return v_mean;
626 }
T sqrt(T number)
Definition: d0nt_math.hpp:156
Float_t Y
Definition: plot.C:38
Float_t Z
Definition: plot.C:38
const double j
Definition: BetheBloch.cxx:29
float Mag() const
Float_t X
Definition: plot.C:38
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

Referenced by art::RootOutput::RootOutput().

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

References art::EventObserverBase::selectors_, and art::detail::CachedProducts::wantEvent().

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

double zcl::FmmTrackerAna::ADC_tot
private

Definition at line 76 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::adc_W
private

Definition at line 103 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::Chisqr_TN
private

Definition at line 101 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::Chisqr_TS
private

Definition at line 100 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

int zcl::FmmTrackerAna::evtID
private

Definition at line 72 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

std::string zcl::FmmTrackerAna::fTrackerInput
private

Definition at line 62 of file FmmTrackerAna_module.cc.

Referenced by analyze().

TRandom* zcl::FmmTrackerAna::genR = new TRandom3()
private

Definition at line 71 of file FmmTrackerAna_module.cc.

Referenced by vfit().

double zcl::FmmTrackerAna::GeV_tot
private

Definition at line 77 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::lxsqr
private

Definition at line 90 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::lysqr
private

Definition at line 90 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

int zcl::FmmTrackerAna::max_gap
private

Definition at line 81 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::MIP_tot
private

Definition at line 75 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

int zcl::FmmTrackerAna::miss_plane
private

Definition at line 81 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

int zcl::FmmTrackerAna::nhits_sat
private

Definition at line 74 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

const int zcl::FmmTrackerAna::ntrials = 100
private

Definition at line 64 of file FmmTrackerAna_module.cc.

Referenced by vfit().

int zcl::FmmTrackerAna::nxhits
private

Definition at line 73 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

int zcl::FmmTrackerAna::nyhits
private

Definition at line 73 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

int zcl::FmmTrackerAna::p_cross
private

Definition at line 81 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

int zcl::FmmTrackerAna::p_overlap
private

Definition at line 81 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

TTree* zcl::FmmTrackerAna::RC_Tree
private

Definition at line 70 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

art::ServiceHandle<nova::dbi::RunHistoryService> zcl::FmmTrackerAna::rh_
private

Definition at line 116 of file FmmTrackerAna_module.cc.

Referenced by endJob().

int zcl::FmmTrackerAna::RunID
private

Definition at line 72 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

int zcl::FmmTrackerAna::subRunID
private

Definition at line 72 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::t_max
private

Definition at line 87 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::t_min
private

Definition at line 87 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::Tf
private

Definition at line 85 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::Ti
private

Definition at line 84 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::tnonSat_mean
private

Definition at line 97 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::tnonSat_rms
private

Definition at line 98 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::tns_max
private

Definition at line 79 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::tns_mean
private

Definition at line 79 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::tns_min
private

Definition at line 79 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::tns_rms
private

Definition at line 79 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::tSat_mean
private

Definition at line 93 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::tSat_rms
private

Definition at line 94 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::vnonSat_err
private

Definition at line 99 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::vrc_nonsat
private

Definition at line 96 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::vrc_sat
private

Definition at line 92 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::vSat_err
private

Definition at line 95 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

const double zcl::FmmTrackerAna::X_err = 1.8
private

Definition at line 65 of file FmmTrackerAna_module.cc.

Referenced by vfit().

double zcl::FmmTrackerAna::x_tmax
private

Definition at line 88 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::x_tmin
private

Definition at line 88 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::Xf
private

Definition at line 85 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::Xi
private

Definition at line 84 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

const double zcl::FmmTrackerAna::Y_err = 1.8
private

Definition at line 66 of file FmmTrackerAna_module.cc.

Referenced by vfit().

double zcl::FmmTrackerAna::y_tmax
private

Definition at line 88 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::y_tmin
private

Definition at line 88 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::Yf
private

Definition at line 85 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::Yi
private

Definition at line 84 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

const double zcl::FmmTrackerAna::Z_err = 2.82
private

Definition at line 67 of file FmmTrackerAna_module.cc.

Referenced by vfit().

double zcl::FmmTrackerAna::z_tmax
private

Definition at line 88 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::z_tmin
private

Definition at line 88 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::Zf
private

Definition at line 85 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().

double zcl::FmmTrackerAna::Zi
private

Definition at line 84 of file FmmTrackerAna_module.cc.

Referenced by analyze(), and beginJob().


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