CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerVariables.h
Go to the documentation of this file.
2 
4 
6  public:
9  for(int i = 0;i!=128;i++){
10  std::stringstream ss;
11  ss<<i;
12  declare(ss.str(), iC);
13  }
14 
15  for(int i = 0;i!=64;i++){
16  std::stringstream ss;
17  ss<<"TechTrig_";
18  ss<<i;
19  declare(ss.str(), iC);
20  }
21 
22 
23  }
25 
26  void compute(const edm::Event & iEvent) const{
28  iEvent.getByToken(src_, l1Handle);
29  if (l1Handle.failedToGet()) doesNotCompute();
30  const DecisionWord & dWord = l1Handle->decisionWord();
31  for(int i = 0;i!=128;i++){
32  std::stringstream ss;
33  ss<<i;
34  double r=dWord.at(i);
35  assign(ss.str(),r);
36  }
37 
38  const TechnicalTriggerWord & tTWord = l1Handle->technicalTriggerWord();
39  for(int i = 0;i!=64;i++){
40  std::stringstream ss;
41  ss<<"TechTrig_";
42  ss<<i;
43  double r=tTWord.at(i);
44  assign(ss.str(),r);
45  }
46 
47 
48 
49  }
50  private:
52 };
53 
57 
59  public:
62  HLTConfigProvider provider;
63  //the function will not work anymore until a major redesign is performed. so long for HLT variables.
64  //provider.init(src_.process());
65  validTriggerNames_ = provider.triggerNames();
66  for (unsigned int iT=0;iT!=validTriggerNames_.size();++iT){
67  TString tname(validTriggerNames_[iT]);
68  tname.ReplaceAll("HLT_","");//remove the "HLT_" prefix
69  declare(std::string(tname), iC);
70  }
71  }
73  void compute(const edm::Event & iEvent) const{
75  iEvent.getByToken(src_,trh);
76  if (!trh.isValid()) doesNotCompute();
77  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*trh);
78  for (unsigned int iT=0;iT!=validTriggerNames_.size();++iT){
79 
80  TString tname(validTriggerNames_[iT]);
81  tname.ReplaceAll("HLT_","");
82  double r=trh->accept(triggerNames.triggerIndex(validTriggerNames_[iT]));
83  assign(std::string(tname),r);
84  }
85 
86  }
87  private:
89  std::vector<std::string> validTriggerNames_;
90 };
91 
93  public:
95  CachingVariable("HLTBitVariable",arg.n,arg.iConfig,iC),
96  src_(iC.consumes<edm::TriggerResults>(edm::Service<InputTagDistributorService>()->retrieve("src",arg.iConfig))),
97  bitName_(arg.n){ arg.m[arg.n]=this;}
100  iEvent.getByToken(src_, hltHandle);
101  if (hltHandle.failedToGet()) return std::make_pair(false,0);
102  const edm::TriggerNames & trgNames = iEvent.triggerNames(*hltHandle);
103  unsigned int index = trgNames.triggerIndex(bitName_);
104  if ( index==trgNames.size() ) return std::make_pair(false,0);
105  else return std::make_pair(true, hltHandle->accept(index));
106 
107  }
108  private:
111 };
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void compute(const edm::Event &iEvent) const
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:199
std::vector< std::string > validTriggerNames_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
HLTBitComputer(CachingVariable::CachingVariableFactoryArg arg, edm::ConsumesCollector &iC)
static char const * tname
Definition: GTSchema.h:13
edm::EDGetTokenT< edm::TriggerResults > src_
Strings::size_type size() const
Definition: TriggerNames.cc:39
A arg
Definition: Factorize.h:36
CachingVariable::evalType eval(const edm::Event &iEvent) const
tuple TriggerResults
Definition: old-fu_pass.py:28
void assign(std::string var, double &value) const
int iEvent
Definition: GenABIO.cc:230
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
L1BitComputer(CachingVariable::CachingVariableFactoryArg arg, edm::ConsumesCollector &iC)
std::vector< bool > DecisionWord
typedefs
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
bool isValid() const
Definition: HandleBase.h:76
HLTBitVariable(CachingVariableFactoryArg arg, edm::ConsumesCollector &iC)
bool failedToGet() const
Definition: HandleBase.h:80
void compute(const edm::Event &iEvent) const
edm::EDGetTokenT< edm::TriggerResults > src_
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > src_
void doesNotCompute() const
void declare(std::string var, edm::ConsumesCollector &iC)
std::string bitName_
std::pair< bool, valueType > evalType