78 virtual void endJob();
120 int getChannelStatusMaps();
131 int setEvtTPstatus(
const double &tpCntCut,
const int &chnStatus);
167 int setEvtRecHitstatus(
const double &tpValCut,
const int &chnStatus,
const int &towerTest);
175 : taggingMode_ (iConfig.getParameter<bool>(
"taggingMode") )
176 , debug_ (iConfig.getParameter<bool>(
"debug") )
177 , verbose_ (iConfig.getParameter<int>(
"verbose") )
178 , doEEfilter_ (iConfig.getUntrackedParameter<bool>(
"doEEfilter") )
179 , ebReducedRecHitCollection_ (iConfig.getParameter<edm::InputTag>(
"ebReducedRecHitCollection") )
180 , eeReducedRecHitCollection_ (iConfig.getParameter<edm::InputTag>(
"eeReducedRecHitCollection") )
181 , maskedEcalChannelStatusThreshold_ (iConfig.getParameter<int>(
"maskedEcalChannelStatusThreshold") )
182 , etValToBeFlagged_ (iConfig.getParameter<double>(
"etValToBeFlagged") )
183 , tpDigiCollection_ (iConfig.getParameter<edm::InputTag>(
"tpDigiCollection") )
184 , makeProfileRoot_ (iConfig.getUntrackedParameter<bool>(
"makeProfileRoot") )
185 , profileRootName_ (iConfig.getUntrackedParameter<std::string>(
"profileRootName") )
194 profTree =
new TTree(
"filter",
"filter profile");
195 profTree->Branch(
"run", &
run,
"run/I");
196 profTree->Branch(
"event", &
event,
"event/I");
197 profTree->Branch(
"lumi", &
ls,
"lumi/I");
220 std::vector<edm::Provenance const*> provenances;
222 const unsigned int nProvenance = provenances.size();
223 for (
unsigned int ip = 0; ip < nProvenance; ip++) {
235 const unsigned int nHist = history.
size();
239 TObjArray *
split = tmpTstr.Tokenize(
"_");
240 int majorV = TString(split->At(1)->GetName()).Atoi();
241 int minorV = TString(split->At(2)->GetName()).Atoi();
252 std::cout<<
"\nWARNING ... Cannot find either tpDigiCollection_ or reducedRecHitCollecion_ ?!"<<std::endl;
253 std::cout<<
" Will NOT DO ANY FILTERING !"<<std::endl;
261 std::cout<<
"\nWARNING ... TP filter can ONLY be used in AOD after 42X"<<std::endl;
262 std::cout<<
" Will NOT DO ANY FILTERING !"<<std::endl;
308 if( !
ecalStatus.isValid() )
throw "Failed to get ECAL channel status!";
316 std::vector<int> cutFlowFlagTmpVec; std::vector<std::string> cutFlowStrTmpVec;
342 cutFlowFlagTmpVec.push_back(evtTagged); cutFlowStrTmpVec.push_back(
"TP");
351 int evtstatusABS =
abs(evtTagged);
352 printf(
"\nrun : %8d event : %10d lumi : %4d evtTPstatus ABS : %d 13 : % 2d\n",
run,
event,
ls, evtstatusABS, evtTagged);
355 std::auto_ptr<bool> pOut(
new bool(pass) );
405 for (ebrechit = HitecalEB.
begin(); ebrechit != HitecalEB.
end(); ebrechit++) {
412 double theta = valItor->second.back();
420 int status = bitItor->second.back();
423 if( chnStatus >0 && status == chnStatus ) toDo =
true;
424 if( chnStatus <0 && status >=
abs(chnStatus) ) toDo =
true;
427 if( !ebrechit->isRecovered() ) toDo =
false;
433 int ttzside = ttDetId.
zside();
435 std::vector<DetId> vid =
ttMap_->constituentsOf(ttDetId);
437 for(std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); ++dit ) {
440 if( towerTest >0 && bit2Itor->second.back() == towerTest )
continue;
441 if( towerTest <0 && bit2Itor->
second.back() >=
abs(towerTest) )
continue;
444 if( towerTestCnt !=0 &&
debug_ &&
verbose_ >=2)
std::cout<<
"towerTestCnt : "<<towerTestCnt<<
" for towerTest : "<<towerTest<<std::endl;
453 std::map<EcalTrigTowerDetId, double>::iterator ttetItor =
accuTTetMap.find(ttDetId);
466 for (eerechit = HitecalEE.
begin(); eerechit != HitecalEE.
end(); eerechit++) {
473 double theta = valItor->second.back();
481 int status = bitItor->second.back();
484 if( chnStatus >0 && status == chnStatus ) toDo =
true;
485 if( chnStatus <0 && status >=
abs(chnStatus) ) toDo =
true;
488 if( !eerechit->isRecovered() ) toDo =
false;
497 std::vector<DetId> vid =
ttMap_->constituentsOf(ttDetId);
499 for(std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); ++dit ) {
502 if( towerTest >0 && bit2Itor->second.back() == towerTest )
continue;
503 if( towerTest <0 && bit2Itor->
second.back() >=
abs(towerTest) )
continue;
506 if( towerTestCnt !=0 &&
debug_ &&
verbose_ >=2)
std::cout<<
"towerTestCnt : "<<towerTestCnt<<
" for towerTest : "<<towerTest<<std::endl;
518 std::map<EcalScDetId, double>::iterator scetItor =
accuSCetMap.find(sc);
531 std::map<EcalTrigTowerDetId, double>::iterator ttetItor;
536 double ttetVal = ttetItor->second;
538 std::map<EcalTrigTowerDetId, int>::iterator ttchnItor =
accuTTchnMap.find(ttDetId);
539 if( ttchnItor ==
accuTTchnMap.end() ){
cout<<
"\nERROR cannot find ttDetId : "<<ttDetId<<
" in accuTTchnMap?!"<<endl<<endl; }
541 std::map<EcalTrigTowerDetId, int>::iterator ttzsideItor =
TTzsideMap.find(ttDetId);
542 if( ttzsideItor ==
TTzsideMap.end() ){
cout<<
"\nERROR cannot find ttDetId : "<<ttDetId<<
" in TTzsideMap?!"<<endl<<endl; }
544 if( ttchnItor->second != 25 &&
debug_ &&
verbose_ >=2)
cout<<
"WARNING ... ttchnCnt : "<<ttchnItor->second<<
" NOT equal 25!"<<endl;
546 if( ttetVal >= tpValCut ){ isPassCut = 1; isPassCut *= ttzsideItor->second; }
551 std::map<EcalScDetId, double>::iterator scetItor;
556 double scetVal = scetItor->second;
558 std::map<EcalScDetId, int>::iterator scchnItor =
accuSCchnMap.find(scDetId);
559 if( scchnItor ==
accuSCchnMap.end() ){
cout<<
"\nERROR cannot find scDetId : "<<scDetId<<
" in accuSCchnMap?!"<<endl<<endl; }
561 std::map<EcalScDetId, int>::iterator sczsideItor =
SCzsideMap.find(scDetId);
562 if( sczsideItor ==
SCzsideMap.end() ){
cout<<
"\nERROR cannot find scDetId : "<<scDetId<<
" in SCzsideMap?!"<<endl<<endl; }
564 if( scchnItor->second != 25 &&
debug_ &&
verbose_ >=2)
cout<<
"WARNING ... scchnCnt : "<<scchnItor->second<<
" NOT equal 25!"<<endl;
566 if( scetVal >= tpValCut ){ isPassCut = 1; isPassCut *= sczsideItor->second; }
583 std::map<DetId, std::vector<int> >::iterator bitItor;
586 DetId maskedDetId = bitItor->first;
587 int subdet = bitItor->second.front(),
status = bitItor->second.back();
596 if( chnStatus >0 &&
status == chnStatus ) toDo =
true;
597 if( chnStatus <0 && status >=
abs(chnStatus) ) toDo =
true;
602 int ttzside = ttDetId.
zside();
607 if( tp != tpDigis->
end() ){
609 if(tpEt >= tpValCut ){ isPassCut = 1; isPassCut *= ttzside; }
625 for(
int ieta=-85; ieta<=85; ieta++ ){
626 for(
int iphi=0; iphi<=360; iphi++ ){
632 int status = ( chit !=
ecalStatus->end() ) ? chit->getStatusCode() & 0x1F : -1;
641 std::vector<double> valVec; std::vector<int> bitVec;
642 valVec.push_back(eta); valVec.push_back(phi); valVec.push_back(theta);
643 bitVec.push_back(1); bitVec.push_back(ieta); bitVec.push_back(iphi); bitVec.push_back(status);
651 for(
int ix=0; ix<=100; ix++ ){
652 for(
int iy=0; iy<=100; iy++ ){
653 for(
int iz=-1; iz<=1; iz++ ){
659 int status = ( chit !=
ecalStatus->end() ) ? chit->getStatusCode() & 0x1F : -1;
668 std::vector<double> valVec; std::vector<int> bitVec;
669 valVec.push_back(eta); valVec.push_back(phi); valVec.push_back(theta);
670 bitVec.push_back(2); bitVec.push_back(ix); bitVec.push_back(iy); bitVec.push_back(iz); bitVec.push_back(status);
679 std::map<DetId, std::vector<int> >::iterator bitItor;
681 const DetId id = bitItor->first;
static bool validDetId(int i, int j)
check if a valid index combination
std::string releaseVersion_
EventNumber_t event() const
const bool makeProfileRoot_
void getAllProvenance(std::vector< Provenance const * > &provenances) const
std::map< DetId, std::vector< int > > EcalAllDeadChannelsBitMap
std::map< EcalScDetId, int > accuSCchnMap
edm::ESHandle< CaloGeometry > geometry
void setEventSetup(const edm::EventSetup &evtSetup)
const std::string profileRootName_
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
std::vector< EcalRecHit >::const_iterator const_iterator
Geom::Theta< T > theta() const
edm::LuminosityBlockNumber_t luminosityBlock() const
collection_type const & data() const
std::vector< DetId > avoidDuplicateVec
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
const int maskedEcalChannelStatusThreshold_
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
int getChannelStatusMaps()
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::map< EcalTrigTowerDetId, int > accuTTchnMap
virtual bool beginRun(edm::Run &, const edm::EventSetup &)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
std::map< EcalScDetId, double > accuSCetMap
const double etValToBeFlagged_
int zside() const
get the z-side of the tower (1/-1)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
Geom::Theta< T > theta() const
U second(std::pair< T, U > const &p)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getEventInfoForFilterOnce_
virtual bool filter(edm::Event &, const edm::EventSetup &)
void loadEventInfoForFilter(const edm::Event &iEvent)
std::vector< std::string > * cutFlowStrTmpPtr
edm::Handle< EcalRecHitCollection > endcapReducedRecHitsHandle
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 but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
edm::Handle< EcalRecHitCollection > barrelReducedRecHitsHandle
static const int ETAPHIMODE
std::map< EcalScDetId, int > SCzsideMap
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
const_iterator end() const
virtual ProcessHistory const & processHistory() const
std::map< EcalTrigTowerDetId, double > accuTTetMap
std::map< DetId, std::vector< double > > EcalAllDeadChannelsValMap
int setEvtRecHitstatus(const double &tpValCut, const int &chnStatus, const int &towerTest)
virtual bool endRun(edm::Run &, const edm::EventSetup &)
std::vector< Item >::const_iterator const_iterator
void loadEventInfo(const edm::Event &iEvent, const edm::EventSetup &iSetup)
std::string const & moduleLabel() const
const edm::InputTag ebReducedRecHitCollection_
tuple EcalDeadCellTriggerPrimitiveFilter
iterator find(key_type k)
EcalDeadCellTriggerPrimitiveFilter(const edm::ParameterSet &)
std::map< EcalTrigTowerDetId, int > TTzsideMap
const edm::InputTag eeReducedRecHitCollection_
void loadEcalRecHits(edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual void envSet(const edm::EventSetup &)
const edm::InputTag tpDigiCollection_
std::map< DetId, EcalTrigTowerDetId > EcalAllDeadChannelsTTMap
edm::ESHandle< EcalChannelStatus > ecalStatus
int setEvtTPstatus(const double &tpCntCut, const int &chnStatus)
void loadEcalDigis(edm::Event &iEvent, const edm::EventSetup &iSetup)
std::vector< int > * cutFlowFlagTmpPtr
const_iterator begin() const
~EcalDeadCellTriggerPrimitiveFilter()
edm::Handle< EcalTrigPrimDigiCollection > pTPDigis