Public Member Functions | Private Attributes | List of all members
DriftAna Class Reference
Inheritance diagram for DriftAna:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 DriftAna (fhicl::ParameterSet const &p)
 
 DriftAna (DriftAna const &)=delete
 
 DriftAna (DriftAna &&)=delete
 
DriftAnaoperator= (DriftAna const &)=delete
 
DriftAnaoperator= (DriftAna &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

TH1D * drifttimenosce
 
TH1D * drifttimeave
 
TH1D * drifttimeint
 
TH1D * fEfield
 
TH1D * fdeltatnosce
 
TH1D * fdeltatave
 
TH1D * fdeltatint
 
TH1D * fdriftvnosce
 
TH1D * fdriftvave
 
TH1D * fdriftvint
 
TH1D * fefieldnosce
 
TH1D * fefieldave
 
TH1D * fefieldint
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 30 of file DriftAna_module.cc.

Constructor & Destructor Documentation

DriftAna::DriftAna ( fhicl::ParameterSet const &  p)
explicit

Definition at line 69 of file DriftAna_module.cc.

70  : EDAnalyzer{p} // ,
71  // More initializers here.
72 {
73  // Call appropriate consumes<>() for any products to be retrieved by this module.
74 }
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
p
Definition: test.py:223
DriftAna::DriftAna ( DriftAna const &  )
delete
DriftAna::DriftAna ( DriftAna &&  )
delete

Member Function Documentation

void DriftAna::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 76 of file DriftAna_module.cc.

77 {
78  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService>()->DataFor(e);
79  double driftv = detProp.DriftVelocity(detProp.Efield(),
80  detProp.Temperature());
81  double efield = detProp.Efield();
82  std::cout<<"E field = "<<efield<<" Nominal drift velocity = "<<driftv<<std::endl;
83 
84  const int n = 100;
85  const double e0 = 0.4;
86  const double e1 = 0.7;
87  std::vector<double> vecv;
88  std::vector<double> vece;
89  for (int i = 0; i<n; ++i){
90  double e_field = e0 + i*(e1-e0)/n;
91  double drift_v = detProp.DriftVelocity(e_field,
92  detProp.Temperature());
93  vecv.push_back(drift_v);
94  vece.push_back(e_field);
95  }
96  TGraph *gr = new TGraph(n, &vecv[0], &vece[0]);
97  for (int i = 1; i<=drifttimeave->GetNbinsX(); ++i){
98  double xyz[3] = {0};
99  xyz[0] = drifttimeave->GetBinCenter(i);
100  xyz[1] = 300;
101  xyz[2] = 350;
102  std::cout<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<std::endl;
103  double driftdis = 358.6 - std::abs(xyz[0]);
104  double drifttime = driftdis/driftv;
105  drifttimenosce->SetBinContent(i, drifttime);
106  geo::Vector_t posOffsets;
107  auto const* SCE = lar::providerFrom<spacecharge::SpaceChargeService>();
108  if (SCE->EnableSimSpatialSCE() == true){
109  posOffsets = SCE->GetPosOffsets({ xyz[0], xyz[1], xyz[2] });
110  }
111  posOffsets.SetX(-posOffsets.X());
112  driftdis += posOffsets.X();
113  drifttime = driftdis/driftv;
114  drifttimeave->SetBinContent(i, drifttime);
115 
116  double dir = 1;
117  if (xyz[0]<0) dir = -1;
118  double xyz1[3];
119  xyz1[0] = xyz[0];
120  xyz1[1] = 300;
121  xyz1[2] = 350;
122  double deltax = 1;
123  double dt = 0;
124  while (std::abs(xyz1[0])<358.6){
125  geo::Vector_t fEfieldOffsets = SCE->GetEfieldOffsets({ xyz1[0], xyz1[1], xyz1[2] });
126  double EField = std::sqrt( (efield + efield*fEfieldOffsets.X())*(efield + efield*fEfieldOffsets.X()) +
127  (efield*fEfieldOffsets.Y()*efield*fEfieldOffsets.Y()) +
128  (efield*fEfieldOffsets.Z()*efield*fEfieldOffsets.Z()) );
129  double v = detProp.DriftVelocity(EField,
130  detProp.Temperature());
131  dt += deltax/v;
132  xyz1[0] += deltax*dir;
133  }
134  drifttimeint->SetBinContent(i, dt);
135 
136  geo::Vector_t fEfieldOffsets = SCE->GetEfieldOffsets({ xyz[0], xyz[1], xyz[2] });
137  double EField = std::sqrt( (efield + efield*fEfieldOffsets.X())*(efield + efield*fEfieldOffsets.X()) +
138  (efield*fEfieldOffsets.Y()*efield*fEfieldOffsets.Y()) +
139  (efield*fEfieldOffsets.Z()*efield*fEfieldOffsets.Z()) );
140  fEfield->SetBinContent(i, EField);
141  }
142 
143  for (int i = 1; i<=drifttimeave->GetNbinsX() - 1; ++i){
144  double x = drifttimeave->GetBinCenter(i);
145  if (x<0){
146  fdeltatnosce->SetBinContent(i, drifttimenosce->GetBinContent(i) - drifttimenosce->GetBinContent(i-1));
147  fdeltatave->SetBinContent(i, drifttimeave->GetBinContent(i) - drifttimeave->GetBinContent(i-1));
148  fdeltatint->SetBinContent(i, drifttimeint->GetBinContent(i) - drifttimeint->GetBinContent(i-1));
149  }
150  else{
151  fdeltatnosce->SetBinContent(i, drifttimenosce->GetBinContent(i) - drifttimenosce->GetBinContent(i+1));
152  fdeltatave->SetBinContent(i, drifttimeave->GetBinContent(i) - drifttimeave->GetBinContent(i+1));
153  fdeltatint->SetBinContent(i, drifttimeint->GetBinContent(i) - drifttimeint->GetBinContent(i+1));
154  }
155  fdriftvnosce->SetBinContent(i, fdeltatnosce->GetBinWidth(i)/fdeltatnosce->GetBinContent(i));
156  fdriftvave->SetBinContent(i, fdeltatave->GetBinWidth(i)/fdeltatave->GetBinContent(i));
157  fdriftvint->SetBinContent(i, fdeltatint->GetBinWidth(i)/fdeltatint->GetBinContent(i));
158  fefieldnosce->SetBinContent(i, gr->Eval(fdeltatnosce->GetBinWidth(i)/fdeltatnosce->GetBinContent(i)));
159  fefieldave->SetBinContent(i, gr->Eval(fdeltatave->GetBinWidth(i)/fdeltatave->GetBinContent(i)));
160  fefieldint->SetBinContent(i, gr->Eval(fdeltatint->GetBinWidth(i)/fdeltatint->GetBinContent(i)));
161  }
162 }
TH1D * drifttimenosce
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
string dir
TH1D * fdriftvnosce
TH1D * fdeltatave
TH1D * fefieldint
T abs(T value)
TH1D * fefieldave
const double e
TH1D * fdeltatint
std::void_t< T > n
TH1D * fdeltatnosce
TH1D * fefieldnosce
TH1D * fEfield
TH1D * drifttimeint
TH1D * fdriftvave
TH1D * fdriftvint
TH1D * drifttimeave
list x
Definition: train.py:276
QTextStream & endl(QTextStream &s)
void DriftAna::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 164 of file DriftAna_module.cc.

165 {
167  drifttimenosce = tfs->make<TH1D>("drifttimenosce",";x (cm);Drift time (#mus)",120,-360,360);
168  drifttimeave = tfs->make<TH1D>("drifttimeave",";x (cm);Drift time (#mus)",120,-360,360);
169  drifttimeint = tfs->make<TH1D>("drifttimeint",";x (cm);Drift time (#mus)",120,-360,360);
170  fEfield = tfs->make<TH1D>("fEfield","E field; x (cm);E field (kV/cm)",120,-360,360);
171 
172  fdeltatnosce = tfs->make<TH1D>("fdeltatnosce",";x (cm);#Delta t (#mus)", 120, -360, 360);
173  fdeltatave = tfs->make<TH1D>("fdeltatave",";x (cm);#Delta t (#mus)", 120, -360, 360);
174  fdeltatint = tfs->make<TH1D>("fdeltatint",";x (cm);#Delta t (#mus)", 120, -360, 360);
175 
176  fdriftvnosce = tfs->make<TH1D>("fdriftvnosce",";x (cm);Drift velocity (cm/#mus)", 120, -360, 360);
177  fdriftvave = tfs->make<TH1D>("fdriftvave",";x (cm);Drift velocity (cm/#mus)", 120, -360, 360);
178  fdriftvint = tfs->make<TH1D>("fdriftvint",";x (cm);Drift velocity (cm/#mus)", 120, -360, 360);
179 
180  fefieldnosce = tfs->make<TH1D>("fefieldnosce",";x (cm);E field (kV/cm)", 120, -360, 360);
181  fefieldave = tfs->make<TH1D>("fefieldave",";x (cm);E field (kV/cm)", 120, -360, 360);
182  fefieldint = tfs->make<TH1D>("fefieldint",";x (cm);E field (kV/cm)", 120, -360, 360);
183 
184 }
TH1D * drifttimenosce
TH1D * fdriftvnosce
TH1D * fdeltatave
TH1D * fefieldint
TH1D * fefieldave
TH1D * fdeltatint
TH1D * fdeltatnosce
TH1D * fefieldnosce
TH1D * fEfield
TH1D * drifttimeint
TH1D * fdriftvave
TH1D * fdriftvint
TH1D * drifttimeave
DriftAna& DriftAna::operator= ( DriftAna const &  )
delete
DriftAna& DriftAna::operator= ( DriftAna &&  )
delete

Member Data Documentation

TH1D* DriftAna::drifttimeave
private

Definition at line 51 of file DriftAna_module.cc.

TH1D* DriftAna::drifttimeint
private

Definition at line 52 of file DriftAna_module.cc.

TH1D* DriftAna::drifttimenosce
private

Definition at line 50 of file DriftAna_module.cc.

TH1D* DriftAna::fdeltatave
private

Definition at line 56 of file DriftAna_module.cc.

TH1D* DriftAna::fdeltatint
private

Definition at line 57 of file DriftAna_module.cc.

TH1D* DriftAna::fdeltatnosce
private

Definition at line 55 of file DriftAna_module.cc.

TH1D* DriftAna::fdriftvave
private

Definition at line 60 of file DriftAna_module.cc.

TH1D* DriftAna::fdriftvint
private

Definition at line 61 of file DriftAna_module.cc.

TH1D* DriftAna::fdriftvnosce
private

Definition at line 59 of file DriftAna_module.cc.

TH1D* DriftAna::fEfield
private

Definition at line 53 of file DriftAna_module.cc.

TH1D* DriftAna::fefieldave
private

Definition at line 64 of file DriftAna_module.cc.

TH1D* DriftAna::fefieldint
private

Definition at line 65 of file DriftAna_module.cc.

TH1D* DriftAna::fefieldnosce
private

Definition at line 63 of file DriftAna_module.cc.


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