17 #include <TObjString.h>
27 passingProbes_.clear();
28 for (
size_t i = 0,
n = view->size();
i <
n; ++
i) passingProbes_.push_back(view->refAt(
i));
35 value_ = (
std::find(passingProbes_.begin(), passingProbes_.end(), probe) != passingProbes_.end());
37 value_ = bool(cut_(*probe));
47 addBranches_(tree_, iConfig,
"");
50 if (iConfig.
existsAs<
double>(
"eventWeight")) {
54 weightMode_ = External;
59 if (weightMode_ != None) {
60 tree_->Branch(
"weight", &weight_,
"weight/F");
63 addRunLumiInfo_ = iConfig.
existsAs<
bool>(
"addRunLumiInfo") ? iConfig.
getParameter<
bool>(
"addRunLumiInfo") :
false;
64 if (addRunLumiInfo_) {
65 tree_->Branch(
"run", &run_,
"run/i");
66 tree_->Branch(
"lumi", &lumi_,
"lumi/i");
67 tree_->Branch(
"event", &event_,
"event/i");
69 addEventVariablesInfo_ = iConfig.
existsAs<
bool>(
"addEventVariablesInfo") ? iConfig.
getParameter<
bool>(
"addEventVariablesInfo") :
false;
70 if (addEventVariablesInfo_) {
71 tree_->Branch(
"event_nPV" ,&mNPV_ ,
"mNPV/I");
72 tree_->Branch(
"event_met_calomet" ,&mMET_ ,
"mMET/F");
73 tree_->Branch(
"event_met_calosumet" ,&mSumET_ ,
"mSumET/F");
74 tree_->Branch(
"event_met_calometsignificance",&mMETSign_ ,
"mMETSign/F");
75 tree_->Branch(
"event_met_tcmet" ,&mtcMET_ ,
"mtcMET/F");
76 tree_->Branch(
"event_met_tcsumet" ,&mtcSumET_ ,
"mtcSumET/F");
77 tree_->Branch(
"event_met_tcmetsignificance",&mtcMETSign_ ,
"mtcMETSign/F");
78 tree_->Branch(
"event_met_pfmet" ,&mpfMET_ ,
"mpfMET/F");
79 tree_->Branch(
"event_met_pfsumet" ,&mpfSumET_ ,
"mpfSumET/F");
80 tree_->Branch(
"event_met_pfmetsignificance",&mpfMETSign_ ,
"mpfMETSign/F");
81 tree_->Branch(
"event_PrimaryVertex_x" ,&mPVx_ ,
"mPVx/F");
82 tree_->Branch(
"event_PrimaryVertex_y" ,&mPVy_ ,
"mPVy/F");
83 tree_->Branch(
"event_PrimaryVertex_z" ,&mPVz_ ,
"mPVz/F");
84 tree_->Branch(
"event_BeamSpot_x" ,&mBSx_ ,
"mBSx/F");
85 tree_->Branch(
"event_BeamSpot_y" ,&mBSy_ ,
"mBSy/F");
86 tree_->Branch(
"event_BeamSpot_z" ,&mBSz_ ,
"mBSz/F");
89 ignoreExceptions_ = iConfig.
existsAs<
bool>(
"ignoreExceptions") ? iConfig.
getParameter<
bool>(
"ignoreExceptions") :
false;
93 addEventVariablesInfo_(
false),
105 for (std::vector<std::string>::const_iterator it = stringVars.begin(), ed = stringVars.end(); it != ed; ++it) {
110 for (std::vector<std::string>::const_iterator it = inputTagVars.begin(), ed = inputTagVars.end(); it != ed; ++it) {
117 for (std::vector<std::string>::const_iterator it = stringFlags.begin(), ed = stringFlags.end(); it != ed; ++it) {
122 for (std::vector<std::string>::const_iterator it = inputTagFlags.begin(), ed = inputTagFlags.end(); it != ed; ++it) {
127 for (std::vector<tnp::ProbeVariable>::iterator it = vars_.begin(), ed = vars_.end(); it != ed; ++it) {
128 tree->Branch(it->name().c_str(), it->address(), (it->name()+
"/F").c_str());
131 for (std::vector<tnp::ProbeFlag>::iterator it = flags_.begin(), ed = flags_.end(); it != ed; ++it) {
132 tree->Branch(it->name().c_str(), it->address(), (it->name()+
"/I").c_str());
140 run_ = iEvent.
id().
run();
144 for (std::vector<tnp::ProbeVariable>::const_iterator it = vars_.begin(), ed = vars_.end(); it != ed; ++it) {
147 for (std::vector<tnp::ProbeFlag>::const_iterator it = flags_.begin(), ed = flags_.end(); it != ed; ++it) {
150 if (weightMode_ == External) {
156 if (addEventVariablesInfo_) {
160 iEvent.
getByLabel(
"offlinePrimaryVertices",recVtxs);
166 for(
unsigned int ind=0;ind<recVtxs->size();ind++) {
167 if (!((*recVtxs)[ind].isFake()) && ((*recVtxs)[ind].ndof()>4)
168 && (fabs((*recVtxs)[ind].
z())<=24.0) &&
169 ((*recVtxs)[ind].position().Rho()<=2.0) ) {
172 mPVx_ = (*recVtxs)[ind].x();
173 mPVy_ = (*recVtxs)[ind].y();
174 mPVz_ = (*recVtxs)[ind].z();
182 iEvent.
getByLabel(
"offlineBeamSpot", beamSpot);
183 mBSx_ = beamSpot->position().X();
184 mBSy_ = beamSpot->position().Y();
185 mBSz_ = beamSpot->position().Z();
191 if (met->size() == 0) {
197 mMET_ = (*met)[0].et();
198 mSumET_ = (*met)[0].sumEt();
199 mMETSign_ = (*met)[0].significance();
205 if (tcmet->size() == 0) {
211 mtcMET_ = (*tcmet)[0].et();
212 mtcSumET_ = (*tcmet)[0].sumEt();
213 mtcMETSign_ = (*tcmet)[0].significance();
219 if (pfmet->size() == 0) {
225 mpfMET_ = (*pfmet)[0].et();
226 mpfSumET_ = (*pfmet)[0].sumEt();
227 mpfMETSign_ = (*pfmet)[0].significance();
234 for (std::vector<tnp::ProbeVariable>::const_iterator it = vars_.begin(), ed = vars_.end(); it != ed; ++it) {
235 if (ignoreExceptions_) {
242 for (std::vector<tnp::ProbeFlag>::const_iterator it = flags_.begin(), ed = flags_.end(); it != ed; ++it) {
243 if (ignoreExceptions_) {
249 if (tree_) tree_->Fill();
252 TList *
list = tree_->GetUserInfo();
253 list->Add(
new TObjString(pset.
dump().c_str()));
T getParameter(std::string const &) const
EventNumber_t event() const
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
BaseTreeFiller(const char *name, const edm::ParameterSet config)
specify the name of the TTree, and the configuration for it
void init(const edm::Event &iEvent) const
To be called at the beginning of the event (will fetch Candidate View if needed)
void writeProvenance(const edm::ParameterSet &pset) const
void fill(const reco::CandidateBaseRef &probe) const
To be called for each item.
std::vector< Variable::Flags > flags
~ProbeFlag()
Destructor (does nothing)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
LuminosityBlockNumber_t luminosityBlock() const
void fill(const reco::CandidateBaseRef &probe) const
To be called once per probe, to fill the values for this probe.
A variable for the probe: can be a string expression or an external ValueMap<float> ...
int main(int argc, char **argv)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
~BaseTreeFiller()
Destructor, does nothing but it's out-of-line as we have complex data members.
void init(const edm::Event &iEvent) const
To be called once per event, to load possible external variables.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
~ProbeVariable()
Destructor (does nothing)
T * make() const
make new ROOT object
void addBranches_(TTree *tree, const edm::ParameterSet &iConfig, const std::string &branchNamePrefix="")
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run