118 if (
verbosity%10 > 0)
std::cout <<
"Event starts====================================" << std::endl;
119 int RunNo = iEvent.
id().
run();
120 int EvtNo = iEvent.
id().
event();
134 iEvent.
getByLabel(
"generalTracks", trkCollection);
135 reco::TrackCollection::const_iterator trkItr;
144 std::cout <<
"RunNo " << RunNo <<
" EvtNo " << EvtNo <<
" Lumi " << Lumi
145 <<
" Bunch " << Bunch <<
" mybxlumi " << mybxlumi << std::endl;
147 edm::InputTag triggerEvent_ (
"hltTriggerSummaryAOD",
"",
"HLT");
150 iEvent.
getByLabel(triggerEvent_,triggerEventHandle);
151 if (!triggerEventHandle.
isValid())
152 std::cout <<
"Error! Can't get the product "<< triggerEvent_.label() << std::endl;
154 triggerEvent = *(triggerEventHandle.
product());
158 edm::InputTag theTriggerResultsLabel (
"TriggerResults",
"",
"HLT");
160 iEvent.
getByLabel( theTriggerResultsLabel, triggerResults);
162 sprintf(TrigName,
"HLT_IsoTrack%s",
Det.c_str());
163 if (triggerResults.
isValid()) {
164 std::vector<std::string>
modules;
165 h_nHLT->Fill(triggerResults->size());
168 const std::vector<std::string> & triggerNames_ = triggerNames.
triggerNames();
169 int hlt(-1), preL1(-1), preHLT(-1), prescale(-1);
170 for (
unsigned int i=0;
i<triggerResults->size();
i++) {
173 if (triggerNames_[i].
find(TrigName)!=std::string::npos) {
175 hlt = triggerResults->accept(i);
178 prescale = preL1*preHLT;
180 std::cout << triggerNames_[
i] <<
" accept " << hlt <<
" preL1 "
181 << preL1 <<
" preHLT " << preHLT << std::endl;
183 std::vector<math::XYZTLorentzVector> vec[3];
187 TrigList.insert(std::pair<unsigned int, unsigned int>(RunNo,1));
191 for (
unsigned int ifilter=0; ifilter<triggerEvent.
sizeFilters(); ++ifilter) {
192 std::vector<int>
Keys;
195 for (
unsigned int imodule=0; imodule<moduleLabels.size(); imodule++) {
196 if (label.find(moduleLabels[imodule]) != std::string::npos) {
198 for (
unsigned int ifiltrKey=0; ifiltrKey<triggerEvent.
filterKeys(ifilter).size(); ++ifiltrKey) {
199 Keys.push_back(triggerEvent.
filterKeys(ifilter)[ifiltrKey]);
202 if(label.find(
"L2Filter") != std::string::npos) {
203 vec[1].push_back(v4);
204 }
else if (label.find(
"L3Filter") != std::string::npos) {
205 vec[2].push_back(v4);
207 vec[0].push_back(v4);
211 std::cout <<
"key " << ifiltrKey <<
" : pt " << TO.pt() <<
" eta " << TO.eta() <<
" phi " << TO.phi() <<
" mass " << TO.mass() <<
" Id " << TO.id() << std::endl;
219 for (
int j=0;
j<3;
j++) {
220 for (
unsigned int k=0;
k<vec[
j].size();
k++) {
221 if (
verbosity%10 > 0)
std::cout <<
"vec[" <<
j <<
"][" <<
k <<
"] pt " << vec[
j][
k].pt() <<
" eta " << vec[
j][
k].eta() <<
" phi " << vec[
j][
k].phi() << std::endl;
226 double deta, dphi, dr;
228 for (
int lvl=1; lvl<3; lvl++) {
229 for (
unsigned int i=0; i<vec[lvl].size(); i++) {
230 deta =
dEta(vec[0][0],vec[lvl][i]);
231 dphi =
dPhi(vec[0][0],vec[lvl][i]);
232 dr =
dR(vec[0][0],vec[lvl][i]);
233 if (
verbosity%10 > 0)
std::cout <<
"lvl " <<lvl <<
" i " << i <<
" deta " << deta <<
" dphi " << dphi <<
" dR " << dr << std::endl;
242 for (
unsigned int k=0;
k<vec[2].size(); ++
k) {
245 if (
verbosity%10 > 0)
std::cout <<
"L3obj: pt " << vec[2][
i].pt() <<
" eta " << vec[2][
i].eta() <<
" phi " << vec[2][
i].phi() << std::endl;
246 for (
unsigned int j=0;
j<vec[1].size();
j++) {
247 dr =
dR(vec[2][
k],vec[1][
j]);
266 if (
verbosity%10 > 0)
std::cout <<
"vec[2][k].eta() " << vec[2][
k].eta() <<
" vec[k][0].phi " << vec[2][
k].phi() << std::endl;
267 reco::TrackCollection::const_iterator goodTk = trkCollection->end();
269 double mindP = 9999.9;
270 for (trkItr=trkCollection->begin();
271 trkItr!=trkCollection->end(); trkItr++) {
273 trkItr->pz(), trkItr->p());
283 std::cout <<
"track: pt " << v4.pt() <<
" eta " << v4.eta()
284 <<
" phi " << v4.phi() <<
" DR " << deltaR
288 if (mindR < 0.03 && mindP > 0.1) {
289 for (trkItr=trkCollection->begin();
290 trkItr!=trkCollection->end(); trkItr++) {
292 trkItr->pz(), trkItr->p());
293 double deltaR =
dR(v4, vec[2][k]);
294 double dp =
std::abs(v4.r()/vec[2][
k].r()-1.0);
295 if (dp<mindP && deltaR<0.03) {
315 iEvent.
getByLabel(
"offlinePrimaryVertices",recVtxs);
318 iEvent.
getByLabel(
"offlineBeamSpot", beamSpotH);
320 if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
321 leadPV =
math::XYZPoint( (*recVtxs)[0].
x(),(*recVtxs)[0].
y(), (*recVtxs)[0].
z() );
322 }
else if (beamSpotH.
isValid()) {
323 leadPV = beamSpotH->position();
326 std::cout <<
"Primary Vertex " << leadPV;
328 << beamSpotH->position();
332 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
334 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
338 iEvent.
getByLabel(
"ecalRecHit",
"EcalRecHitsEB",barrelRecHitsHandle);
339 iEvent.
getByLabel(
"ecalRecHit",
"EcalRecHitsEE",endcapRecHitsHandle);
341 unsigned int nTracks=0, ngoodTk=0, nselTk=0;
343 for (trkDetItr = trkCaloDirections.begin(); trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++){
344 bool l3Track = (trkDetItr->trkItr == goodTk);
345 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
347 pTrack->
pz(), pTrack->
p());
349 double eMipDR=9999., e_inCone=0, conehmaxNearP=0, mindR=999.9;
350 if (trkDetItr->okHCAL) {
354 for (
unsigned k=0; k<vec[0].size(); ++
k) {
355 double deltaR =
dR(v4, vec[0][k]);
356 if (deltaR<mindR) mindR =
deltaR;
358 if (selectTk && trkDetItr->okECAL && trkDetItr->okHCAL) {
360 int nRH_eMipDR=0, nNearTRKs=0;
362 trkDetItr->pointHCAL, trkDetItr->pointECAL,
363 a_neutR1, trkDetItr->directionECAL, nRH_eMipDR);
365 trkDetItr->pointHCAL, trkDetItr->pointECAL,
366 a_neutR2, trkDetItr->directionECAL, nRH_eMipDR);
367 eMipDR =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
368 trkDetItr->pointHCAL, trkDetItr->pointECAL,
369 a_mipR, trkDetItr->directionECAL, nRH_eMipDR);
372 if (eMipDR<1.0) nselTk++;
378 fillCuts(0, eMipDR, conehmaxNearP, e_inCone, v4, ieta, (mindR>
dr_L1));
391 fillCuts(1, eMipDR, conehmaxNearP, e_inCone, v4, ieta, (mindR>
dr_L1));
420 std::cout<<
"New trigger menu found !!!" << std::endl;
422 for (
unsigned itrig=0; itrig<triggerNames_.size(); itrig++) {
424 std::cout << triggerNames_[itrig] <<
" " << triggerindx <<
" ";
425 if (triggerindx >=
n)
426 std::cout <<
"does not exist in the current menu" << std::endl;
unsigned int size() const
number of trigger paths in trigger table
double p() const
momentum vector magnitude
EventNumber_t event() const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
The single EDProduct to be saved for each event (AOD case)
trigger::size_type sizeFilters() const
std::string theTrackQuality
const Keys & filterKeys(trigger::size_type index) const
int bunchCrossing() const
edm::LuminosityBlockNumber_t luminosityBlock() const
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
double px() const
x coordinate of momentum vector
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Strings const & triggerNames() const
HLTConfigProvider hltConfig_
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
Single trigger physics object (e.g., an isolated muon)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void fillHist(int, math::XYZTLorentzVector &)
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
const TriggerObjectCollection & getObjects() const
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
LuminosityBlock const & getLuminosityBlock() const
static std::string const triggerResults
std::map< unsigned int, const std::pair< int, int > > TrigPreList
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double dPhi(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
double dR(double eta1, double eta2, double phi1, double phi2)
double pz() const
z coordinate of momentum vector
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
const edm::InputTag filterTag(trigger::size_type index) const
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< size_type > Keys
double dEta(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
T const * product() const
std::pair< int, int > prescaleValues(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger) const
Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path.
T const * product() const
spr::trackSelectionParameters selectionParameters
std::map< unsigned int, unsigned int > TrigList
double eCone_ecal(const CaloGeometry *geo, edm::Handle< T > &barrelhits, edm::Handle< T > &endcaphits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500)
void fillDifferences(int, math::XYZTLorentzVector &, math::XYZTLorentzVector &, bool)
tuple size
Write out results.
void fillCuts(int, double, double, double, math::XYZTLorentzVector &, int, bool)
double py() const
y coordinate of momentum vector