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

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 ClusterEva (fhicl::ParameterSet const &pset)
 
virtual ~ClusterEva ()
 
void beginJob ()
 
void analyze (const art::Event &evt)
 
void reconfigure (const fhicl::ParameterSet &p)
 
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 Attributes

std::string fCellHitInput
 
std::string fClusterInput
 Input folder from cluster reco. More...
 
unsigned fNpart
 
TTree * ClusterTruth
 
bool _view
 
double _tmin
 
double _tmax
 
int _nhits
 
int _eventID
 
int _ADC
 
std::vector< float > _nTH
 
std::vector< float > _nTHtot
 
std::vector< float > _TADC
 
std::vector< float > _TADCtot
 
std::vector< float > _Ttmin
 
std::vector< float > _Ttmax
 
std::vector< float > _Tenergy
 

Detailed Description

Definition at line 43 of file ClusterEva_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

pa::ClusterEva::ClusterEva ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 73 of file ClusterEva_module.cc.

References reconfigure().

74  : EDAnalyzer(pset)
75  {
76  reconfigure(pset);
77  }
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
void reconfigure(const fhicl::ParameterSet &p)
pa::ClusterEva::~ClusterEva ( )
virtual

Definition at line 80 of file ClusterEva_module.cc.

81  {
82  }

Member Function Documentation

void pa::ClusterEva::analyze ( const art::Event evt)

Definition at line 114 of file ClusterEva_module.cc.

References _ADC, _eventID, _nhits, _nTH, _nTHtot, _TADC, _TADCtot, _Tenergy, _tmax, _tmin, _Ttmax, _Ttmin, _view, rawdata::RawDigit::ADC(), rb::Cluster::Cell(), ClusterTruth, DEFINE_ART_MODULE(), simb::MCParticle::E(), art::EventID::event(), fCellHitInput, fClusterInput, geom(), art::DataViewImpl::getByLabel(), cheat::BackTracker::HitToParticle(), MECModelEnuComparisons::i, art::Event::id(), cheat::BackTracker::IsNoise(), geo::kX, rb::Cluster::NCell(), part, rb::CellHit::TNS(), and simb::MCParticle::TrackId().

115  {
116  _eventID = evt.id().event();
117 
118  //make a backtracker
120  // define vector holding the clusters
122  evt.getByLabel(fClusterInput, slices);
124  evt.getByLabel(fCellHitInput, hitcol);
125 
127 
128  for(unsigned sliceIdx = 0; sliceIdx != slices->size(); ++sliceIdx){
129  //Now you are inside a new cluster, you have to clear the vector:
130  _nTH.clear();
131  _nTHtot.clear();
132  _TADC.clear();
133  _TADCtot.clear();
134  _Ttmin.clear();
135  _Ttmax.clear();
136  _Tenergy.clear();
137 
138  const rb::Cluster& slice = (*slices)[sliceIdx];
139  _ADC = 0;
140  _tmin = (slice.Cell(0))->TNS();
141  _tmax =_tmin;
142  _nhits = slice.NCell();
143  if ((slice.Cell(0))-> View()==geo::kX) _view = 0;
144  else _view = 1;
145 
146  std::vector<int> track_ides;
147 
148  for(int hitIdx = 0; hitIdx != _nhits; ++hitIdx){
149 
150  const art::Ptr<rb::CellHit> chit = slice.Cell(hitIdx);
151  _ADC += chit->ADC();
152 
153  if (_tmin > chit->TNS() ) _tmin=chit->TNS();
154  if (_tmax < chit->TNS() ) _tmax=chit->TNS();
155 
156  //Now work on MC truth:
157  try {
158  if (!bt->IsNoise(chit)) {
159  const sim::Particle *part = bt->HitToParticle(chit);
160 
161  if ( find(track_ides.begin(),track_ides.end(),part->TrackId()) == track_ides.end())
162  {
163 
164  // std::cout<<"new particle track id:"<<part->TrackId()<<std::endl;
165  track_ides.push_back(part->TrackId() );
166  //Initialize items:
167  int cheater_nhits = 0;
168  int cheater_ADC = 0;
169  float cheater_tmin = 9.e19;
170  float cheater_tmax = -9.e10;
171 
172  //Now you have to loop over all the hits to check the true hits mainly caused by this particle:
173  for (unsigned i=0; i != hitcol->size(); ++i) {
174 
175  art::Ptr<rb::CellHit> hit_ptr(hitcol, i);
176  /*
177  if (!_view && hit_ptr->View()==geo::kY) continue;
178  else if (_view && hit_ptr->View()==geo::kX) continue;
179  */
180  // std::cout<<"pass view check"<<std::endl;
181  if (bt->HitToParticle(hit_ptr) == part) {
182  // std::cout<<"Get the particle ID:"<<(bt->HitToParticle(hit_ptr) )->TrackId()<<std::endl;
183  ++cheater_nhits;
184  cheater_ADC+=hit_ptr->ADC();
185 
186  // std::cout<<cheater_nhits<<"th hit with ADC "<<hit_ptr->ADC()<<std::endl;
187  if (cheater_tmin > hit_ptr->TNS() ) cheater_tmin = hit_ptr->TNS();
188  if (cheater_tmax < hit_ptr->TNS() ) cheater_tmax = hit_ptr->TNS();
189  }
190  }
191 
192  _nTH.push_back(1);
193  _TADC.push_back(chit->ADC());
194 
195  _Tenergy.push_back(part->E() );
196  _nTHtot.push_back(cheater_nhits);
197  _TADCtot.push_back(cheater_ADC);
198  _Ttmin.push_back(cheater_tmin);
199  _Ttmax.push_back(cheater_tmax);
200 
201  // std::cout<<"real energy of this particle: "<<part->E()<<" GeV"<<std::endl;
202 
203 
204  }
205  //Or this particle has been left trace in previous hits:
206  else {
207  int particle_idx = find(track_ides.begin(),track_ides.end(),part->TrackId()) - track_ides.begin();
208 
209  ++_nTH.at(particle_idx);
210  _TADC.at(particle_idx) += chit->ADC();
211 
212  }
213  }
214  }
215  catch (...) {
216  continue;
217  }
218  }//End looping over this slice
219 
220  //Fill the tree:
221  /*
222  std::cout<<"clustered hits Particle size: "<<_nTH.size()<<std::endl;
223  std::cout<<"clustered ADC Particle size: " <<_TADC.size()<<std::endl;
224  std::cout<<"total hits Particle size: " <<_nTHtot.size()<<std::endl;
225  std::cout<<"total ADC Particle size: " <<_TADC.size()<<std::endl;
226  std::cout<<"size of truth energy: " <<_Tenergy.size()<<std::endl;
227  */
228  ClusterTruth->Fill();
229 
230 
231  }// end looping over all slices
232 
233  return;
234 
235  } //end analyze
double E(const int i=0) const
Definition: MCParticle.h:232
float TNS() const
Definition: CellHit.h:46
std::vector< float > _TADC
std::string fClusterInput
Input folder from cluster reco.
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
std::vector< float > _Ttmin
Vertical planes which measure X.
Definition: PlaneGeo.h:28
A collection of associated CellHits.
Definition: Cluster.h:47
const sim::Particle * HitToParticle(art::Ptr< rb::CellHit > const &hit, bool quiet=false) const
Returns the sim::Particle object contributing the most light to the specified rb::CellHit.
std::string fCellHitInput
bool IsNoise(const art::Ptr< rb::CellHit > &hit) const
Is this hit not associated with any particles?
int TrackId() const
Definition: MCParticle.h:209
TString part[npart]
Definition: Style.C:32
std::vector< float > _Tenergy
std::vector< float > _TADCtot
Definition: View.py:1
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
std::vector< float > _nTHtot
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
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
std::vector< float > _nTH
std::vector< float > _Ttmax
EventID id() const
Definition: Event.h:56
void pa::ClusterEva::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 93 of file ClusterEva_module.cc.

References _ADC, _eventID, _nhits, _nTH, _nTHtot, _TADC, _TADCtot, _Tenergy, _tmax, _tmin, _Ttmax, _Ttmin, _view, ClusterTruth, and art::TFileDirectory::make().

94  {
96  ClusterTruth = tfs->make<TTree>("ClusterTruth","Hough Phase Space");
97 
98  ClusterTruth -> Branch("evtID", &_eventID, "evtID/I");
99  ClusterTruth -> Branch("view", &_view, "VIEW/O"); //0: X; 1: Y
100  ClusterTruth -> Branch("Tmin", &_tmin, "Tmin/D");
101  ClusterTruth -> Branch("Tmax", &_tmax, "Tmax/D");
102  ClusterTruth -> Branch("Nhits", &_nhits, "Nhits/I");
103  ClusterTruth -> Branch("totADC",&_ADC, "totADC/I");
104 
105  ClusterTruth -> Branch("TrueHits", &_nTH);
106  ClusterTruth -> Branch("totTrueHits", &_nTHtot);
107  ClusterTruth -> Branch("TrueADC", &_TADC);
108  ClusterTruth -> Branch("totTrueADC", &_TADCtot);
109  ClusterTruth -> Branch("TrueTmin", &_Ttmin);
110  ClusterTruth -> Branch("TrueTmax", &_Ttmax);
111  ClusterTruth -> Branch("TrueEnergy", &_Tenergy);
112  }
std::vector< float > _TADC
std::vector< float > _Ttmin
std::vector< float > _Tenergy
std::vector< float > _TADCtot
std::vector< float > _nTHtot
T * make(ARGS...args) const
std::vector< float > _nTH
std::vector< float > _Ttmax
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
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 pa::ClusterEva::reconfigure ( const fhicl::ParameterSet p)

Definition at line 85 of file ClusterEva_module.cc.

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

Referenced by ClusterEva().

86  {
87  fCellHitInput = pset.get< std::string >("CellHitInput");
88  fClusterInput = pset.get< std::string >("ClusterInput") ;
89 
90  }
std::string fClusterInput
Input folder from cluster reco.
std::string fCellHitInput
enum BeamMode string
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
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

int pa::ClusterEva::_ADC
private

Definition at line 60 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

int pa::ClusterEva::_eventID
private

Definition at line 59 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

int pa::ClusterEva::_nhits
private

Definition at line 59 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

std::vector<float> pa::ClusterEva::_nTH
private

Definition at line 61 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

std::vector<float> pa::ClusterEva::_nTHtot
private

Definition at line 62 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

std::vector<float> pa::ClusterEva::_TADC
private

Definition at line 63 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

std::vector<float> pa::ClusterEva::_TADCtot
private

Definition at line 64 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

std::vector<float> pa::ClusterEva::_Tenergy
private

Definition at line 67 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

double pa::ClusterEva::_tmax
private

Definition at line 58 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

double pa::ClusterEva::_tmin
private

Definition at line 58 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

std::vector<float> pa::ClusterEva::_Ttmax
private

Definition at line 66 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

std::vector<float> pa::ClusterEva::_Ttmin
private

Definition at line 65 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

bool pa::ClusterEva::_view
private

Definition at line 57 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

TTree* pa::ClusterEva::ClusterTruth
private

Definition at line 56 of file ClusterEva_module.cc.

Referenced by analyze(), and beginJob().

std::string pa::ClusterEva::fCellHitInput
private

Definition at line 53 of file ClusterEva_module.cc.

Referenced by analyze(), and reconfigure().

std::string pa::ClusterEva::fClusterInput
private

Input folder from cluster reco.

Definition at line 54 of file ClusterEva_module.cc.

Referenced by analyze(), and reconfigure().

unsigned pa::ClusterEva::fNpart
private

Definition at line 55 of file ClusterEva_module.cc.


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