Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
calib::MuondEdx Class Reference
Inheritance diagram for calib::MuondEdx:
art::EDFilter art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = ProducerBase::Table< UserConfig >
 

Public Member Functions

 MuondEdx (fhicl::ParameterSet const &p)
 
virtual ~MuondEdx ()
 
bool filter (art::Event &e) override
 
void reconfigure (fhicl::ParameterSet const &p)
 
void beginJob () override
 
void endJob () override
 
bool beginRun (art::Run &r) override
 
bool endRun (art::Run &r) override
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () 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 ()
 

Static Public Attributes

static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 

Protected Member Functions

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

Private Member Functions

double getPECorr (art::Event &e, caldp::PCHit const &pchit)
 

Private Attributes

TH2D * fdEdx
 
TH2D * fdEdx_minus
 
TH2D * fdEdx_plus
 
TH2D * fdEdx_true
 
std::string fPCHitLabel
 
std::string fQualXYName
 
std::string fStopperLabel
 
double fSysShift
 

Detailed Description

Definition at line 50 of file MuondEdx_module.cc.

Member Typedef Documentation

using art::EDFilter::ModuleType = EDFilter
inherited

Definition at line 37 of file EDFilter.h.

template<typename UserConfig >
using art::EDFilter::Table = ProducerBase::Table<UserConfig>
inherited

Definition at line 46 of file EDFilter.h.

using art::EDFilter::WorkerType = WorkerT<EDFilter>
inherited

Definition at line 38 of file EDFilter.h.

Constructor & Destructor Documentation

calib::MuondEdx::MuondEdx ( fhicl::ParameterSet const &  p)
explicit

Definition at line 79 of file MuondEdx_module.cc.

80  {
81  this->reconfigure(p);
82  produces< TH2D, art::InRun >("dEdx");
83  produces< TH2D, art::InRun >("dEdxMinus");
84  produces< TH2D, art::InRun >("dEdxPlus");
85  produces< TH2D, art::InRun >("dEdxTrue");
86  }
void reconfigure(fhicl::ParameterSet const &p)
const char * p
Definition: xmltok.h:285
calib::MuondEdx::~MuondEdx ( )
virtual

Definition at line 88 of file MuondEdx_module.cc.

89  {
90  // Clean up dynamic memory and other resources here.
91  }

Member Function Documentation

void calib::MuondEdx::beginJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 177 of file MuondEdx_module.cc.

References art::TFileDirectory::make().

178  {
179  // histograms for output
181  fdEdx = tfs->make<TH2D>("dEdx",";Distance to track end (cm);PECorr / cm;",
182  50,0.,500.,200,0.,200.);
183  fdEdx_minus = tfs->make<TH2D>("dEdx_minus",";Distance to track end (cm);PECorr / cm;",
184  50,0.,500.,200,0.,200.);
185  fdEdx_plus = tfs->make<TH2D>("dEdx_plus",";Distance to track end (cm);PECorr / cm;",
186  50,0.,500.,200,0.,200.);
187  fdEdx_true = tfs->make<TH2D>("dEdx_true",";Distance to track end (cm);True MeV / cm;",
188  50,0.,500.,200,0.,5.);
189  }
T * make(ARGS...args) const
bool calib::MuondEdx::beginRun ( art::Run r)
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 191 of file MuondEdx_module.cc.

191  {
192  return true;
193  }
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::EDFilter::currentContext ( ) const
protectedinherited
void calib::MuondEdx::endJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 210 of file MuondEdx_module.cc.

References DEFINE_ART_MODULE().

211  {
212 
213  }
bool calib::MuondEdx::endRun ( art::Run r)
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 195 of file MuondEdx_module.cc.

References art::TFileDirectory::make(), and art::Run::put().

195  {
196 
198  std::unique_ptr<TH2D> pdEdx(tfs->make<TH2D>(*fdEdx));
199  std::unique_ptr<TH2D> pdEdx_minus(tfs->make<TH2D>(*fdEdx_minus));
200  std::unique_ptr<TH2D> pdEdx_plus(tfs->make<TH2D>(*fdEdx_plus));
201  std::unique_ptr<TH2D> pdEdx_true(tfs->make<TH2D>(*fdEdx_true));
202 
203  r.put(std::move(pdEdx),"dEdx");
204  r.put(std::move(pdEdx_minus),"dEdxMinus");
205  r.put(std::move(pdEdx_plus),"dEdxPlus");
206  r.put(std::move(pdEdx_true),"dEdxTrue");
207  return true;
208  }
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:149
T * make(ARGS...args) const
bool calib::MuondEdx::filter ( art::Event e)
overridevirtual

Get the reconstructed tracks

Implements art::EDFilter.

Definition at line 93 of file MuondEdx_module.cc.

References geo::GeometryBase::CellId(), PandAna.Demos.tute_pid_validation::cid, geo::GeometryBase::DetId(), geo::GeometryBase::FirstPlaneInMuonCatcher(), art::DataViewImpl::getByLabel(), geo::GeometryBase::getPlaneID(), hits(), MECModelEnuComparisons::i, calib::j, novadaq::cnv::kNEARDET, path, and submit_syst::x.

94  {
95  /// Get the reconstructed tracks
97  e.getByLabel(fStopperLabel, tracks);
98  if( tracks->size() == 0 ) return true;
99 
101  if( !PCHitGetter.isValid() ) return false;
102 
103  // loop over stopping tracks in event
104  for( unsigned int i=0; i<tracks->size(); ++i ){
105 
106  // needed for track window, but good generally to reject protons
107  if( (*tracks)[i].TotalLength() < 200. ) continue;
108 
109  TVector3 stopXYZ;
112  int stopPlaneID = 10000;
113  int firstMuCPlane = -1;
114  bool isNearDet = false;
115 
116  //continue if track ends in the muon catcher
117  if(fGeo->DetId() == novadaq::cnv::kNEARDET){
118  isNearDet = true;
119  stopXYZ = (*tracks)[i].Start();
120  cid = fGeo->CellId(stopXYZ[0], stopXYZ[1], stopXYZ[2], 1.5, 1.5, 6., 1.0);
121  if(cid) stopPlaneID = fGeo->getPlaneID(cid);
122  firstMuCPlane = fGeo->FirstPlaneInMuonCatcher();
123  if(stopPlaneID >= firstMuCPlane) continue;
124  }
125 
126  // loop over PCHits associated to stopping track
127  std::vector<art::Ptr<caldp::PCHit> > hits = PCHitGetter.at(i);
128  if( hits.size() == 0 ) continue;
129  for( unsigned int j=0; j<hits.size(); ++j ){
130 
131  //cut if hit is inside muon catcher
132  if(isNearDet)
133  if(hits[j]->Plane() >= firstMuCPlane) continue;
134 
135  double x = (*tracks)[i].TotalLength() - hits[j]->FlightLen();
136  double path = hits[j]->Path();
137  double trueE = hits[j]->TrueMeV();
138  double PECorr = this->getPECorr(e,*hits[j]);
139  fdEdx->Fill(x,PECorr/path);
140  fdEdx_minus->Fill(x-fSysShift,PECorr/path);
141  fdEdx_plus->Fill(x+fSysShift,PECorr/path);
142  fdEdx_true->Fill(x,trueE/path);
143  }
144  }
145 
146 
147  return true;
148 
149 
150  }
std::string fStopperLabel
std::string fQualXYName
void hits()
Definition: readHits.C:15
int getPlaneID(const CellUniqueId &id) const
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
Near Detector in the NuMI cavern.
const CellUniqueId CellId(const double &x, const double &y, const double &z, double dxds=0., double dyds=0., double dzds=1., double step=0.01) const
const double j
Definition: BetheBloch.cxx:29
const std::string path
Definition: plot_BEN.C:43
unsigned long long int CellUniqueId
Definition: CellUniqueId.h:15
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
double getPECorr(art::Event &e, caldp::PCHit const &pchit)
std::string fPCHitLabel
const unsigned int FirstPlaneInMuonCatcher() const
Returns the index of the first plane contained in the muon catcher.
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
double calib::MuondEdx::getPECorr ( art::Event e,
caldp::PCHit const &  pchit 
)
private

Definition at line 151 of file MuondEdx_module.cc.

References caldp::PCHit::Cell(), calib::Calibrator::GetPECorr(), caldp::PCHit::GoodTime(), art::Event::isRealData(), caldp::PCHit::PE(), caldp::PCHit::Plane(), rb::CellHit::SetCell(), rawdata::RawDigit::SetMC(), rb::CellHit::SetPE(), rb::CellHit::SetPlane(), rb::CellHit::SetTNS(), rb::CellHit::SetView(), caldp::PCHit::TNS(), caldp::PCHit::View(), and caldp::PCHit::W().

151  {
152 
153  //Calibrator necessary to get Atten information
155 
156  //Make mock cellhit
157  rb::CellHit cellhit;
158  cellhit.SetPlane(pchit.Plane());
159  cellhit.SetCell(pchit.Cell());
160  cellhit.SetView(pchit.View());
161  cellhit.SetTNS(pchit.TNS(),pchit.GoodTime());
162  if(!e.isRealData())cellhit.SetMC(); // assume only filled for MC...
163  cellhit.SetPE(pchit.PE());
164 
165  double pecorr = calibrator->GetPECorr(cellhit, pchit.W());
166  return pecorr;
167  }
void SetTNS(float tns, bool good)
Definition: CellHit.h:56
bool isRealData() const
Definition: Event.h:83
void SetView(geo::View_t view)
Definition: CellHit.h:54
void SetPlane(unsigned short plane)
Definition: CellHit.h:53
void SetCell(unsigned short cell)
Definition: CellHit.h:52
void SetPE(float pe)
Definition: CellHit.h:55
void SetMC(bool isMC=true)
Definition: RawDigit.h:106
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
double GetPECorr(rb::CellHit const &cellhit, double w)
template<typename PROD , BranchType B>
ProductID art::EDFilter::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 131 of file EDFilter.h.

References art::EDFilter::moduleDescription_.

Referenced by novaddt::HoughTrackMaker::create_associations().

132  {
133  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
134  instanceName);
135  }
ModuleDescription moduleDescription_
Definition: EDFilter.h:124
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
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::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void calib::MuondEdx::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 169 of file MuondEdx_module.cc.

References fhicl::ParameterSet::get(), and string.

170  {
171  fPCHitLabel = pset.get< std::string >("PCHitLabel"); //Label of PCHitList module
172  fQualXYName = pset.get< std::string >("QualXYName"); //Instance label, "XY" quality hits
173  fStopperLabel = pset.get<std::string>("StopperLabel");
174  fSysShift = pset.get<double>("SysShift"); // track end point systematic shift
175  }
std::string fStopperLabel
std::string fQualXYName
std::string fPCHitLabel
enum BeamMode string
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

constexpr bool art::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.h.

Referenced by evgen::GENIEFilter::filter().

TH2D* calib::MuondEdx::fdEdx
private

Definition at line 65 of file MuondEdx_module.cc.

TH2D* calib::MuondEdx::fdEdx_minus
private

Definition at line 66 of file MuondEdx_module.cc.

TH2D* calib::MuondEdx::fdEdx_plus
private

Definition at line 67 of file MuondEdx_module.cc.

TH2D* calib::MuondEdx::fdEdx_true
private

Definition at line 68 of file MuondEdx_module.cc.

std::string calib::MuondEdx::fPCHitLabel
private

Definition at line 70 of file MuondEdx_module.cc.

std::string calib::MuondEdx::fQualXYName
private

Definition at line 71 of file MuondEdx_module.cc.

std::string calib::MuondEdx::fStopperLabel
private

Definition at line 72 of file MuondEdx_module.cc.

double calib::MuondEdx::fSysShift
private

Definition at line 74 of file MuondEdx_module.cc.

constexpr bool art::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.h.

Referenced by evgen::GENIEFilter::filter().


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