14 #include "TDirectory.h" 17 #include "TLorentzVector.h" 18 #include "TInterpreter.h" 135 usesResource(
"TFileService");
137 const double isolationRadius(28.9);
185 std::cout <<
"Parameters read from config file \n" 187 <<
"\t theTrackQuality " << theTrackQuality_
197 <<
"\t a_coneR " << a_coneR_
200 <<
"\t isMC " <<
isMC_ 201 <<
"\t isQCD " << isQCD_
202 <<
"\t isAOD " << isAOD_
204 std::cout << trigNames_.size() <<
" triggers to be studied:";
205 for (
unsigned int k=0;
k<trigNames_.size(); ++
k)
226 <<
" starts ==========" << std::endl;
244 reco::TrackCollection::const_iterator trkItr;
262 if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
263 leadPV =
math::XYZPoint( (*recVtxs)[0].
x(),(*recVtxs)[0].
y(), (*recVtxs)[0].
z() );
264 }
else if (beamSpotH.
isValid()) {
269 std::cout <<
"Primary Vertex " << leadPV;
285 bool triggerOK =
false;
292 if (!triggerEventHandle.
isValid()) {
301 if (triggerResults.
isValid()) {
303 const std::vector<std::string> & triggerNames_ = triggerNames.
triggerNames();
304 for (
unsigned int iHLT=0; iHLT<triggerResults->
size(); iHLT++) {
308 if (triggerNames_[iHLT].
find(
trigNames_[
i].c_str())!=std::string::npos) {
312 std::cout <<
"This is the trigger we are looking for " 313 << triggerNames_[iHLT] <<
" Flag " << hlt
326 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
330 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
331 unsigned int nTracks(0), nselTracks(0);
332 t_nTrk = trkCaloDirections.size();
334 for (trkDetItr = trkCaloDirections.begin(),
nTracks=0;
335 trkDetItr != trkCaloDirections.end(); trkDetItr++,
nTracks++) {
337 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
341 << pTrack->
pt() <<
"/" << pTrack->
eta() <<
"/" 342 << pTrack->
phi() <<
"/" << pTrack->
p() << std::endl;
346 if (trkDetItr->okHCAL) {
358 oneCutParameters.
maxDzPV = 100;
364 oneCutParameters.
maxDzPV = 100;
373 std::cout <<
"qltyFlag|okECAL|okHCAL : " << qltyFlag <<
"|" 374 << trkDetItr->okECAL <<
"/" << trkDetItr->okHCAL
377 if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) {
379 int nRH_eMipDR(0), nNearTRKs(0);
383 trkDetItr->pointHCAL,
384 trkDetItr->pointECAL,
385 a_mipR_, trkDetItr->directionECAL,
401 int nRecHits(-999), nRecHits1(-999), nRecHits3(-999);
402 std::vector<DetId> ids, ids1, ids3;
406 trkDetItr->directionHCAL,nRecHits,
409 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
415 trkDetItr->directionHCAL,nRecHits1,
418 for (
unsigned int k = 0;
k < ids1.size(); ++
k) {
424 trkDetItr->directionHCAL,nRecHits3,
427 for (
unsigned int k = 0;
k < ids3.size(); ++
k) {
437 << pTrack->
pt() <<
"/" << pTrack->
eta() <<
"/" 438 << pTrack->
phi() <<
"/" <<
t_p << std::endl;
444 for (
unsigned int lll=0;lll<
t_DetIds->size();lll++) {
467 tree->Branch(
"t_Run", &
t_Run,
"t_Run/I");
468 tree->Branch(
"t_Event", &
t_Event,
"t_Event/I");
469 tree->Branch(
"t_nVtx", &
t_nVtx,
"t_nVtx/I");
470 tree->Branch(
"t_nTrk", &
t_nTrk,
"t_nTrk/I");
471 tree->Branch(
"t_EventWeight", &
t_EventWeight,
"t_EventWeight/D");
472 tree->Branch(
"t_p", &
t_p,
"t_p/D");
473 tree->Branch(
"t_pt", &
t_pt,
"t_pt/D");
474 tree->Branch(
"t_ieta", &
t_ieta,
"t_ieta/I");
475 tree->Branch(
"t_phi", &
t_phi,
"t_phi/D");
476 tree->Branch(
"t_eMipDR", &
t_eMipDR,
"t_eMipDR/D");
477 tree->Branch(
"t_eHcal", &
t_eHcal,
"t_eHcal/D");
478 tree->Branch(
"t_eHcal10", &
t_eHcal10,
"t_eHcal10/D");
479 tree->Branch(
"t_eHcal30", &
t_eHcal30,
"t_eHcal30/D");
480 tree->Branch(
"t_hmaxNearP", &
t_hmaxNearP,
"t_hmaxNearP/D");
481 tree->Branch(
"t_selectTk", &
t_selectTk,
"t_selectTk/O");
482 tree->Branch(
"t_qltyMissFlag",&
t_qltyMissFlag,
"t_qltyMissFlag/O");
483 tree->Branch(
"t_qltyPVFlag", &
t_qltyPVFlag,
"t_qltyPVFlag/O)");
485 t_DetIds =
new std::vector<unsigned int>();
486 t_DetIds1 =
new std::vector<unsigned int>();
487 t_DetIds3 =
new std::vector<unsigned int>();
492 tree->Branch(
"t_DetIds",
"std::vector<unsigned int>", &
t_DetIds);
493 tree->Branch(
"t_DetIds1",
"std::vector<unsigned int>", &t_DetIds1);
494 tree->Branch(
"t_DetIds3",
"std::vector<unsigned int>", &t_DetIds3);
495 tree->Branch(
"t_HitEnergies",
"std::vector<double>", &t_HitEnergies);
496 tree->Branch(
"t_HitEnergies1",
"std::vector<double>", &t_HitEnergies1);
497 tree->Branch(
"t_HitEnergies3",
"std::vector<double>", &t_HitEnergies3);
506 <<
" process HLT init flag " 507 << flag <<
" change flag " << changed_;
512 edm::LogInfo(
"HcalIsoTrack") <<
"New trigger menu found !!!";
514 for (
unsigned itrig=0; itrig<
trigNames_.size(); itrig++) {
516 if (triggerindx >=
n) {
518 << triggerindx <<
" does not exist in " 519 <<
"the current menu";
522 << triggerindx <<
" exists";
unsigned int size() const
number of trigger paths in trigger table
std::vector< double > * t_HitEnergies3
double p() const
momentum vector magnitude
edm::InputTag triggerEvent_
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
const unsigned int nTracks(const reco::Vertex &sv)
edm::InputTag theTriggerResultsLabel_
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
The single EDProduct to be saved for each event (AOD case)
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override
bool accept() const
Has at least one path accepted the event?
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt_
int bunchCrossing() const
edm::LuminosityBlockNumber_t luminosityBlock() const
double phi() const
azimuthal angle of momentum vector
T * make(const Args &...args) const
make new ROOT object
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< unsigned int > * t_DetIds1
std::vector< unsigned int > * t_DetIds3
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
Strings const & triggerNames() const
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
double maxNeighborTrackEnr_
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
double eta() const
pseudorapidity of momentum vector
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< std::string > HLTNames_
edm::EDGetTokenT< GenEventInfoProduct > tok_ew_
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
unsigned int size() const
Get number of paths stored.
double pt() const
track transverse momentum
int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
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, bool debug=false)
static std::string const triggerResults
IsoTrackCalibration(const edm::ParameterSet &)
std::vector< double > * t_HitEnergies
std::vector< std::string > trigNames_
virtual void beginJob() override
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
static TrackQuality qualityByName(const std::string &name)
XYZPointD XYZPoint
point in space with cartesian internal representation
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
std::string theTrackQuality_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
virtual void analyze(edm::Event const &, edm::EventSetup const &) override
spr::trackSelectionParameters selectionParameters_
reco::TrackBase::TrackQuality minQuality
virtual void endRun(edm::Run const &, edm::EventSetup const &) override
const Point & position() const
position
edm::Service< TFileService > fs_
std::vector< double > * t_HitEnergies1
std::vector< unsigned int > * t_DetIds
HLTConfigProvider hltConfig_
T const * product() const
double eCone_hcal(const CaloGeometry *geo, edm::Handle< T > &hits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int detOnly=-1, bool useRaw=false, bool debug=false)
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_