Public Member Functions | Private Attributes | List of all members
filt::CFilter Class Reference
Inheritance diagram for filt::CFilter:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 CFilter (fhicl::ParameterSet const &pset)
 
virtual ~CFilter ()
 
virtual bool filter (art::Event &e)
 
void reconfigure (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDFilter
 EDFilter (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDFilter (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Filter
virtual ~Filter () noexcept
 
 Filter (fhicl::ParameterSet const &)
 
 Filter (Filter const &)=delete
 
 Filter (Filter &&)=delete
 
Filteroperator= (Filter const &)=delete
 
Filteroperator= (Filter &&)=delete
 
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 &)
 
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 Attributes

std::string fSimulationProducerLabel
 
std::string fRawDigitLabel
 
int fCounterType
 
int fSelectedPDG
 
int fTrigger
 
int fnumTracks
 
std::string fHitsModuleLabel
 
std::string fTrackModuleLabel
 

Additional Inherited Members

- Public Types inherited from art::EDFilter
using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
- Public Types inherited from art::detail::Filter
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Attributes inherited from art::detail::Filter
static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 
- 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 38 of file CFilter_module.cc.

Constructor & Destructor Documentation

filt::CFilter::CFilter ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 64 of file CFilter_module.cc.

64  : EDFilter{pset}
65  {
66  this->reconfigure(pset);
67 
68  }
void reconfigure(fhicl::ParameterSet const &pset)
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21
virtual filt::CFilter::~CFilter ( )
inlinevirtual

Definition at line 41 of file CFilter_module.cc.

41 { }

Member Function Documentation

bool filt::CFilter::filter ( art::Event e)
virtual

Implements art::EDFilter.

Definition at line 84 of file CFilter_module.cc.

85  {
86  //muon conter geometry
87  int counters_loaded=-1;
88  std::vector<std::vector<double> > countergeometry;
89  //load the muon counter positions from a text file
90 
91  char counterfile[]= "/afs/fnal.gov/files/home/room1/melnimr/lr_dev_7/srcs/dunetpc/dune/Geometry/muoncounters.txt";
92  counters_loaded=geo::MuonCounter35Alg::loadMuonCounterGeometry(counterfile,countergeometry);
93  bool keepFlag=0;
94 
95  // int icount=0; int trkind;
96  // define the handle as an MCParticle vector and fill it with events from the simulation
97  auto particleHandle = event.getHandle< std::vector<simb::MCParticle> >(fSimulationProducerLabel);
98 
99  // define a sorted map in which to put the particles
100  std::map< int, const simb::MCParticle* > particleMap;
101  // loop over all the particles, find the primary muon, and get the initial/final positions
102  for ( auto const& particle : (*particleHandle) )
103  {
104  // For the methods you can call to get particle information,
105  // see $NUTOOLS_INC/SimulationBase/MCParticle.h.
106  int fTrackID = particle.TrackId();
107  // Add the address of the MCParticle to the map, with the track ID as the key.
108  particleMap[fTrackID] = &particle;
109  // PDG code of every particle in the event.
110  // int fPDG = particle.PdgCode();
111  // locate the primary muon
112  // if ( particle.Process() == "primary" && fPDG == fSelectedPDG )
113  // {
114 
115  // A particle has a trajectory, consisting of a set of
116  // 4-positions and 4-mommenta.
117  size_t numberTrajectoryPoints = particle.NumberTrajectoryPoints();
118  // For trajectories, as for vectors and arrays, the
119  // first point is #0, not #1.
120  int last = numberTrajectoryPoints - 1;
121  const TLorentzVector& positionStart = particle.Position(0);
122  const TLorentzVector& positionEnd = particle.Position(last);
123  const TLorentzVector& momentumStart = particle.Momentum(0);
124  const TLorentzVector& momentumEnd = particle.Momentum(last);
125  // move the initial position (for muon counter studies)
126  double x_increment = 0.; // 349.666
127  double z_increment = 0.; // 231.065
128  TVector3 trackStart(positionStart.X()+x_increment,positionStart.Y(),positionStart.Z()+z_increment);
129  //}
130 
131  std::vector< std::vector<double> > hitcounters;
132  if(counters_loaded){
133  //unsigned int counters_hit=0;
134 
135  geo::MuonCounter35Alg::testTrackInAllCounters(fTrackID,trackStart,momentumStart.Vect(),
136  countergeometry,hitcounters);
137  }
138 
139 
140  // condition flags for each layer
141  bool Layer_1_2 = false;
142  bool Layer_3_4_5 = false;
143  bool Layer_E = false;
144  bool Layer_W = false;
145  bool Layer_N_U = false;
146  bool Layer_N_L = false;
147  bool Layer_S_U = false;
148  bool Layer_S_L = false;
149  int Trigger= 0;
150 
151  for(unsigned int ii=0;ii<hitcounters.size();ii++)
152  {
153  // for(unsigned int jj=0;jj<hitcounters[ii].size();jj++)
154  // {
155  std::cout<< "::Filter, counters triggered are: "<<hitcounters[ii][0] <<std::endl;
156  /* if (hitcounters[ii][0]==fCounterType)
157  {
158  keepFlag=1;
159  return keepFlag;
160  }*/
161  // check which layer is hit
162  if( 40 <= hitcounters[ii][0] && hitcounters[ii][0] <= 61){
163  Layer_1_2 = true;
164  }
165  if( hitcounters[ii][0] > 61){
166  Layer_3_4_5 = true;
167  }
168  if (14 <= hitcounters[ii][0] && hitcounters[ii][0] <=19){
169  Layer_N_U = true;
170  }
171  if ( 34 <= hitcounters[ii][0] && hitcounters[ii][0] <= 39){
172  Layer_S_L = true;
173  }
174  if (8 <= hitcounters[ii][0] && hitcounters[ii][0] <= 13){
175  Layer_N_L = true;
176  }
177  if (28 <= hitcounters[ii][0] && hitcounters[ii][0] <= 33){
178  Layer_S_U = true;
179  }
180  if (hitcounters[ii][0] <= 7){
181  Layer_E = true;
182  }
183  if (20 <= hitcounters[ii][0] && hitcounters[ii][0] <= 27){
184  Layer_W = true;
185  }
186  // }
187  }
188  // check for a satisfied trigger condition
189  if (Layer_1_2 && Layer_3_4_5){
190  Trigger = 1;
191  }
192  if (Layer_N_U && Layer_S_L){
193  Trigger = 2;
194  }
195  if (Layer_N_L && Layer_S_U){
196  Trigger = 3;
197  }
198  if (Layer_E && Layer_W){
199  Trigger = 4;
200  }
201  std::cout << "Trigger is ....." << Trigger << std::endl;
202  if(Trigger==fTrigger)
203  {
204  keepFlag=1;
205  return keepFlag;
206  }
207  }
208  return keepFlag;
209  }
std::string fSimulationProducerLabel
static int loadMuonCounterGeometry(char *filename, std::vector< std::vector< double > > &geometry)
static int testTrackInAllCounters(int trackID, TVector3 trackpoint, TVector3 trackvector, std::vector< std::vector< double > > &geometry, std::vector< std::vector< double > > &hitcounters)
QTextStream & endl(QTextStream &s)
void filt::CFilter::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 70 of file CFilter_module.cc.

71  {
72 
73  fSimulationProducerLabel = p.get< std::string >("SimulationLabel");
74  // fCounterFile = p.get< std::string >("CounterFile");
75  fSelectedPDG = p.get< int >("PDGcode");
76  fCounterType=p.get< int >("CounterType");
77  fTrigger=p.get< int >("Trigger");
78  fnumTracks=1;
79 
80  // fnumTracks = pset.get<int>("numTracks");
81 
82  }
std::string string
Definition: nybbler.cc:12
std::string fSimulationProducerLabel
p
Definition: test.py:223

Member Data Documentation

int filt::CFilter::fCounterType
private

Definition at line 51 of file CFilter_module.cc.

std::string filt::CFilter::fHitsModuleLabel
private

Definition at line 59 of file CFilter_module.cc.

int filt::CFilter::fnumTracks
private

Definition at line 58 of file CFilter_module.cc.

std::string filt::CFilter::fRawDigitLabel
private

Definition at line 49 of file CFilter_module.cc.

int filt::CFilter::fSelectedPDG
private

Definition at line 52 of file CFilter_module.cc.

std::string filt::CFilter::fSimulationProducerLabel
private

Definition at line 48 of file CFilter_module.cc.

std::string filt::CFilter::fTrackModuleLabel
private

Definition at line 60 of file CFilter_module.cc.

int filt::CFilter::fTrigger
private

Definition at line 53 of file CFilter_module.cc.


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