Public Member Functions | Private Member Functions | Private Attributes | List of all members
calo::GeneralCalorimetry Class Reference
Inheritance diagram for calo::GeneralCalorimetry:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 GeneralCalorimetry (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob ()
 
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::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- 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 Member Functions

void produce (art::Event &evt)
 

Private Attributes

std::string fTrackModuleLabel
 module creating the track objects and assns to hits More...
 
double fADCToElectrons
 filled using the detinfo::DetectorPropertiesService service More...
 
geo::View_t fCollectionView
 view of the collection plane More...
 
unsigned int fCollectionPlane
 plane of the collection plane More...
 
art::ServiceHandle< geo::Geometry const > fGeo
 
CalorimetryAlg caloAlg
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- 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 GeneralCalorimetry_module.cc.

Constructor & Destructor Documentation

calo::GeneralCalorimetry::GeneralCalorimetry ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 54 of file GeneralCalorimetry_module.cc.

55  : EDProducer{pset}
57  , fCollectionPlane(0)
58  , caloAlg(pset.get< fhicl::ParameterSet >("CaloAlg"))
59 {
60  auto const* dp = lar::providerFrom<detinfo::DetectorPropertiesService>();
61  fADCToElectrons = 1./dp->ElectronsToADC();
62 
63  // determine the view of the collection plane
64  // just look at one cryostat, the first TPC and loop over those
65  // planes
66  geo::TPCID FirstTPC(0, 0);
67  for(unsigned int p = 0; p < fGeo->Nplanes(FirstTPC); ++p){
68  geo::PlaneID planeid{ FirstTPC, p };
69  if(fGeo->SignalType(planeid) == geo::kCollection){
70  fCollectionView = fGeo->View(planeid);
72  }
73  }
74 
75  fTrackModuleLabel = pset.get< std::string >("TrackModuleLabel");
76 
77  produces< std::vector<anab::Calorimetry> >();
78  produces< art::Assns<recob::Track, anab::Calorimetry> >();
79 }
double fADCToElectrons
filled using the detinfo::DetectorPropertiesService service
art::ServiceHandle< geo::Geometry const > fGeo
std::string string
Definition: nybbler.cc:12
Unknown view.
Definition: geo_types.h:132
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
The data type to uniquely identify a Plane.
Definition: geo_types.h:468
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
geo::View_t fCollectionView
view of the collection plane
The data type to uniquely identify a TPC.
Definition: geo_types.h:382
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
unsigned int fCollectionPlane
plane of the collection plane
p
Definition: test.py:223
std::string fTrackModuleLabel
module creating the track objects and assns to hits
Signal from collection planes.
Definition: geo_types.h:142

Member Function Documentation

void calo::GeneralCalorimetry::produce ( art::Event evt)
privatevirtual

Implements art::EDProducer.

Definition at line 82 of file GeneralCalorimetry_module.cc.

83 {
84  /*************************************************************/
85  /* WARNING */
86  /*************************************************************/
87  /* The dQdx information in recob::Track has been deprecated */
88  /* since 2016 and in 11/2018 the recob::Track interface was */
89  /* changed and DQdxAtPoint and NumberdQdx were removed. */
90  /* Therefore the code below is now commented out */
91  /* (note that it was most likely not functional anyways). */
92  /* For any issue please contact: larsoft-team@fnal.gov */
93  /*************************************************************/
94  /*
95  art::Handle< std::vector<recob::Track> > trackHandle;
96  evt.getByLabel(fTrackModuleLabel, trackHandle);
97  std::vector< art::Ptr<recob::Track> > tracks;
98  art::fill_ptr_vector(tracks, trackHandle);
99 
100  auto const* dp = lar::providerFrom<detinfo::DetectorPropertiesService>();
101 
102  //create anab::Calorimetry objects and make association with recob::Track
103  std::unique_ptr< std::vector<anab::Calorimetry> > calorimetrycol(new std::vector<anab::Calorimetry>);
104  std::unique_ptr< art::Assns<recob::Track, anab::Calorimetry> > assn(new art::Assns<recob::Track, anab::Calorimetry>);
105 
106  art::FindMany<recob::Hit> fmht(trackHandle, evt, fTrackModuleLabel);
107 
108  // loop over the tracks
109  for(size_t t = 0; t < tracks.size(); ++t){
110 
111  art::Ptr<recob::Track> trk = tracks.at(t);
112 
113  double viewPitch = 0.;
114  try{
115  viewPitch = lar::util::TrackPitchInView(*trk, fCollectionView);
116  }
117  catch( cet::exception &e){
118  mf::LogWarning("GeneralCalorimetry") << "caught exception "
119  << e
120  << "\n pitch now set to 0";
121  }
122 
123  // loop over the track trajectory to get the kinetic energy,
124  // residual range and the dQdx
125  float kineticEnergy = 0.;
126  std::vector<float> vdEdx;
127  std::vector<float> vresRange;
128  std::vector<float> vdQdx;
129  std::vector<float> deadwire; //residual range for dead wires
130 
131  // Check that the number of trajectory points and number of dQdx for the
132  // collection view are the same
133  if( trk->NumberTrajectoryPoints() != trk->NumberdQdx(fCollectionView) )
134  throw cet::exception("GeneralCalorimetry") << "inconsistent number of track trajectory "
135  << " and dQdx points\n";
136 
137  if (trk->NumberTrajectoryPoints()>2){
138  for(size_t p = 1; p < trk->NumberTrajectoryPoints()-1; ++p){
139  if (!trk->DQdxAtPoint(p, fCollectionView)) continue;
140  vresRange.push_back(trk->Length(p));
141  vdQdx.push_back(trk->DQdxAtPoint(p, fCollectionView));
142  //vdEdx.push_back(vdQdx.back() * fADCToElectrons/util::kGeVToElectrons*1000);
143  vdEdx.push_back(caloAlg.dEdx_AMP(vdQdx.back(),
144  dp->ConvertXToTicks(trk->LocationAtPoint(p).X(),fCollectionPlane,0,0),
145  fCollectionPlane));
146  kineticEnergy += vdEdx.back(); // \todo should this be converted from electrons to energy?
147  std::cout<<vresRange.back()<<" "<<vdQdx.back()<<" "<<vdEdx.back()<<std::endl;
148  }
149 
150  geo::PlaneID planeID(0,0,fCollectionPlane);
151  calorimetrycol->push_back(anab::Calorimetry(kineticEnergy,
152  vdEdx,
153  vdQdx,
154  vresRange,
155  deadwire,
156  trk->Length(),
157  viewPitch,
158  planeID));
159 
160  util::CreateAssn(*this, evt, *calorimetrycol, trk, *assn);
161 
162  }
163  }// end of loop over all tracks
164 
165  if (calorimetrycol->size()){
166  evt.put(std::move(calorimetrycol));
167  evt.put(std::move(assn));
168  }
169 
170  */
171  /*************************************************************/
172  return;
173 }

Member Data Documentation

CalorimetryAlg calo::GeneralCalorimetry::caloAlg
private

Definition at line 46 of file GeneralCalorimetry_module.cc.

double calo::GeneralCalorimetry::fADCToElectrons
private

filled using the detinfo::DetectorPropertiesService service

Definition at line 41 of file GeneralCalorimetry_module.cc.

unsigned int calo::GeneralCalorimetry::fCollectionPlane
private

plane of the collection plane

Definition at line 43 of file GeneralCalorimetry_module.cc.

geo::View_t calo::GeneralCalorimetry::fCollectionView
private

view of the collection plane

Definition at line 42 of file GeneralCalorimetry_module.cc.

art::ServiceHandle<geo::Geometry const> calo::GeneralCalorimetry::fGeo
private

Definition at line 44 of file GeneralCalorimetry_module.cc.

std::string calo::GeneralCalorimetry::fTrackModuleLabel
private

module creating the track objects and assns to hits

Definition at line 40 of file GeneralCalorimetry_module.cc.


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