hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TridentWABAnaProcessor.h
Go to the documentation of this file.
1#ifndef __TRIDENTWAB_ANAPROCESSOR_H__
2#define __TRIDENTWAB_ANAPROCESSOR_H__
3
4
5//HPSTR
6#include "HpsEvent.h"
7#include "Collections.h"
8#include "EventHeader.h"
9#include "Vertex.h"
10#include "Track.h"
11#include "TrackerHit.h"
12#include "RawSvtHit.h"
13#include "Particle.h"
14#include "Processor.h"
15#include "BaseSelector.h"
16#include "TridentHistos.h"
17#include "FlatTupleMaker.h"
18#include "AnaHelpers.h"
19#include "MCParticle.h"
20#include "TSData.h"
21//ROOT
22#include "TFile.h"
23#include "TTree.h"
24#include "TBranch.h"
25#include "TVector3.h"
26
27//C++
28#include <memory>
29#include <random>
30#include <iterator>
32
33public:
34 TridentWABAnaProcessor(const std::string& name, Process& process);
36 virtual bool process(IEvent* ievent);
37
38 virtual void initialize(TTree* tree);
39
40 virtual void finalize();
41
42 virtual void configure(const ParameterSet& parameters);
43
44private:
45
46 std::shared_ptr<BaseSelector> vtxSelector;
47 std::shared_ptr<BaseSelector> trkSelector;
48 std::vector<std::string> regionSelections_;
49 std::vector<std::string> regionWABSelections_;
50
51 std::string selectionCfg_;
52 std::string trkSelCfg_;
53
54
55 TBranch* bfspart_{nullptr};
56 TBranch* bvtxs_{nullptr};
57 TBranch* btrks_{nullptr};
58 TBranch* bhits_{nullptr};
59 TBranch* brawhits_{nullptr};
60 TBranch* bclus_{nullptr};
61 TBranch* btsdata_{nullptr};
62 TBranch* bmcParts_{nullptr};
63 TBranch* bevth_{nullptr};
64
65 std::vector<Vertex*> * vtxs_{};
66 std::vector<TrackerHit*> * hits_{};
67 std::vector<RawSvtHit*> * rawhits_{};
68 std::vector<Particle*> * fspart_{};
69 std::vector<Track*> * trks_{};
70 std::vector<CalCluster*> * clus_{};
71 std::vector<MCParticle*> * mcParts_{};
72 EventHeader* evth_{nullptr};
73 TSData* tsdata_{nullptr};
74
75 std::string anaName_{"vtxAna"};
76 std::string mcColl_{"MCParticle"};
77 std::string hitColl_{"SiClustersOnTrack"};
78 std::string rawhitColl_{"TrackRawHits"};
79 std::string cluColl_{"Vertices"};
80 std::string vtxColl_{"Vertices"};
81 std::string tsdataColl_{"TSData"};
82 std::string fspartColl_{"FinalStateParticles_KF"};
83 std::string trkColl_{"GBLTracks"};
84 TTree* tree_{nullptr};
85
86 std::shared_ptr<TridentHistos> _vtx_histos;
87
88 //Duplicate.. We can make a single class.. ?
89 std::map<std::string, std::shared_ptr<BaseSelector> > _reg_vtx_selectors;
90 std::map<std::string, std::shared_ptr<TridentHistos> > _reg_vtx_histos;
91 std::map<std::string, std::shared_ptr<FlatTupleMaker> > _reg_tuples;
92
93 std::map<std::string, std::shared_ptr<BaseSelector> > _reg_WAB_selectors;
94 std::map<std::string, std::shared_ptr<TridentHistos> > _reg_WAB_histos;
95
96 std::vector<std::string> _regions;
97 std::vector<std::string> _regionsWAB;
98
99
100 typedef std::map<std::string,std::shared_ptr<TridentHistos> >::iterator reg_it;
101
102 std::string histoCfg_{""};
103 double calTimeOffset_{-999};
104 double trkTimeOffset_{-999};
105 //In GeV. Default is 2016 value;
106 double beamE_{2.3};
107 int isData{0};
108 std::shared_ptr<AnaHelpers> _ah;
109 Vertex* matchPairToVertex(Track* ele,Track* pos, std::vector<Vertex*>& verts);
110 std::pair<Track*,MCParticle*> matchToMCParticle(Track* part, std::vector<MCParticle*>& mcParts);
111
112 std::vector<CalCluster*> getUnmatchedClusters(std::vector<CalCluster*>& allClusters,std::vector<std::pair<CalCluster*,Track*> > electrons, std::vector<std::pair<CalCluster*,Track*> > positrons);
113
119
125
126
127 template<typename Iter, typename RandomGenerator>
128 Iter select_randomly(Iter start, Iter end, RandomGenerator& g) {
129 std::uniform_int_distribution<> dis(0, std::distance(start, end) - 1);
130 std::advance(start, dis(g));
131 return start;
132 }
133
134 template<typename Iter>
135 Iter select_randomly(Iter start, Iter end) {
136 static std::random_device rd;
137 static std::mt19937 gen(rd());
138 return select_randomly(start, end, gen);
139 }
140
141 //Debug level
142 int debug_{0};
143};
144
145#endif
Helper class for hipster analysis.
Class used to encapsulate event information.
Class used to encapsulate information about a mc particle.
Class used to encapsulate information about a particle.
Base classes for all user event processing components to extend.
Class used to encapsulate raw svt hit information.
Class used to decode TS words.
Class used to encapsulate track information.
Class used to encapsulate tracker hit information.
Class used to encapsulate Vertex information.
Definition IEvent.h:7
description
Base class for all event processing components.
Definition Processor.h:34
virtual bool process()
Process the histograms and generate analysis output.
Definition Processor.h:95
Definition Track.h:32
std::map< std::string, std::shared_ptr< BaseSelector > > _reg_WAB_selectors
std::vector< std::string > regionWABSelections_
std::vector< RawSvtHit * > * rawhits_
virtual void configure(const ParameterSet &parameters)
Callback for the Processor to configure itself from the given set of parameters.
std::shared_ptr< TridentHistos > _vtx_histos
virtual void finalize()
Callback for the Processor to take any necessary action when the processing of events finishes,...
Iter select_randomly(Iter start, Iter end)
std::vector< std::string > regionSelections_
virtual void initialize(TTree *tree)
Callback for the Processor to take any necessary action when the processing of events starts,...
std::map< std::string, std::shared_ptr< TridentHistos > > _reg_vtx_histos
std::vector< Track * > * trks_
std::map< std::string, std::shared_ptr< BaseSelector > > _reg_vtx_selectors
std::vector< CalCluster * > * clus_
std::map< std::string, std::shared_ptr< TridentHistos > > _reg_WAB_histos
std::shared_ptr< BaseSelector > vtxSelector
std::vector< TrackerHit * > * hits_
std::vector< std::string > _regionsWAB
std::map< std::string, std::shared_ptr< TridentHistos > >::iterator reg_it
std::map< std::string, std::shared_ptr< FlatTupleMaker > > _reg_tuples
Iter select_randomly(Iter start, Iter end, RandomGenerator &g)
std::shared_ptr< AnaHelpers > _ah
Vertex * matchPairToVertex(Track *ele, Track *pos, std::vector< Vertex * > &verts)
std::pair< Track *, MCParticle * > matchToMCParticle(Track *part, std::vector< MCParticle * > &mcParts)
std::shared_ptr< BaseSelector > trkSelector
std::vector< Particle * > * fspart_
std::vector< CalCluster * > getUnmatchedClusters(std::vector< CalCluster * > &allClusters, std::vector< std::pair< CalCluster *, Track * > > electrons, std::vector< std::pair< CalCluster *, Track * > > positrons)
std::vector< Vertex * > * vtxs_
std::vector< std::string > _regions
std::vector< MCParticle * > * mcParts_