#include <L1TriggerOffline/BSCTriggerSimulation/src/BSCTrigger.cc>
Public Member Functions | |
BSCTrigger (const edm::ParameterSet &) | |
~BSCTrigger () | |
Private Member Functions | |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
int | getBSCNum (int id, float z) |
bool | isInner (int id) |
bool | isZplus (int id) |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
std::vector< std::string > | names_ |
int | nevt_ |
unsigned | nEvt_ |
float | theCoincidence_ |
edm::InputTag | TheHits_tag_ |
int | theNinner_ |
int | theNouter_ |
float | theResolution_ |
std::vector< unsigned > | ttBits_ |
Implementation: <Notes on="" implementation>="">
Definition at line 40 of file BSCTrigger.cc.
BSCTrigger::BSCTrigger | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 76 of file BSCTrigger.cc.
References edm::ParameterSet::getParameter(), names_, nevt_, theCoincidence_, TheHits_tag_, theNinner_, theNouter_, theResolution_, and ttBits_.
00077 { 00078 ttBits_=iConfig.getParameter< std::vector<unsigned> >("bitNumbers"); 00079 names_= iConfig.getParameter< std::vector<std::string> >("bitNames"); 00080 theCoincidence_= iConfig.getParameter<double>("coincidence"); 00081 theResolution_= iConfig.getParameter<double>("resolution"); 00082 theNinner_=iConfig.getParameter<int>("minbiasInnerMin"); 00083 theNouter_=iConfig.getParameter<int>("minbiasOuterMin"); 00084 TheHits_tag_= iConfig.getParameter<edm::InputTag>("theHits"); 00085 produces<L1GtTechnicalTriggerRecord>(); 00086 nevt_=0; 00087 }
BSCTrigger::~BSCTrigger | ( | ) |
Definition at line 90 of file BSCTrigger.cc.
00091 { 00092 00093 // do anything here that needs to be done at desctruction time 00094 // (e.g. close files, deallocate resources etc.) 00095 00096 }
void BSCTrigger::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
Definition at line 236 of file BSCTrigger.cc.
References edm::isDebugEnabled(), and LogTrace.
Referenced by produce().
00236 { 00237 int zside = 0; 00238 if ( z > 0 ) zside = 1; 00239 if ( edm::isDebugEnabled() ) { 00240 int det = (id&24)>>3; 00241 int station = id&7; 00242 LogTrace("BSCTrig")<<"id="<<id<<" zside="<<zside<<" det="<<det<<" station="<<station; 00243 } 00244 int BSCNum; 00245 if (id&16) BSCNum=32+(id&1)+(zside<<1) ; // small paddles further from IP 00246 else BSCNum= (id&15)+(zside<<4); // the BSC on the HF 00247 return BSCNum; 00248 }
void BSCTrigger::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 105 of file BSCTrigger.cc.
References funct::abs(), c, edm::Handle< T >::failedToGet(), getBSCNum(), edm::Event::getByLabel(), i, edm::isDebugEnabled(), isInner(), isZplus(), LogDebug, LogTrace, names_, nevt_, output(), edm::Event::put(), funct::sqrt(), t, theCoincidence_, TheHits_tag_, theNinner_, theNouter_, theResolution_, and ttBits_.
00106 { 00107 std::vector<L1GtTechnicalTrigger> ttVec(ttBits_.size()); 00108 std::vector<float>EnergyBX(32); 00109 std::vector<float>EnergyBXMinusDt(32); 00110 int ZMinnerBX=0, ZMouterBX=0; 00111 int ZPinnerBX=0, ZPouterBX=0; 00112 ++nevt_; 00113 std::auto_ptr<L1GtTechnicalTriggerRecord> BscRecord; 00114 float MipFraction=0.7; 00115 float MipEnergy=0.0027; 00116 float theThreshold=MipFraction*MipEnergy; 00117 edm::Handle<edm::PSimHitContainer> theBSCHitContainer; 00118 iEvent.getByLabel(TheHits_tag_,theBSCHitContainer); 00119 00120 if (!theBSCHitContainer.failedToGet()) { 00121 for ( int c=0;c<32;++c){ 00122 EnergyBX[c]=0; 00123 EnergyBXMinusDt[c]=0; 00124 } 00125 edm::PSimHitContainer::const_iterator itHit, jtHit; 00126 float dt1,dt2; 00127 dt1=theCoincidence_/2 + theResolution_; 00128 dt2=theCoincidence_/2 - theResolution_; 00129 if ( edm::isDebugEnabled() ) LogDebug("BSCTrig")<<" ----------------new event ---with "<<theBSCHitContainer->size()<<" hits in the BSC"; 00130 for (itHit = theBSCHitContainer->begin(); itHit != theBSCHitContainer->end(); ++itHit) { 00131 float zh=itHit->entryPoint().z()/10; 00132 int id=getBSCNum(itHit->detUnitId(),zh); 00133 if ( id > 31 ) continue; // the small 2 paddles further from the IP 00134 float t=itHit->timeOfFlight(); 00135 if ( edm::isDebugEnabled() ) { 00136 float rh=sqrt(itHit->entryPoint().x()*itHit->entryPoint().x()+itHit->entryPoint().y()*itHit->entryPoint().y())/10; 00137 LogTrace("BSCTrig")<<" BSC Num "<<id<<" z="<<zh<<" isZplus="<<isZplus(id)<<" Hit DetId="<<getBSCNum(id,zh)<<" r="<<rh<<" isInner="<<isInner(id); 00138 LogTrace("BSCTrig")<<" Hit time="<<t<<" accepted range=["<<dt2<<","<<dt1<<"] from a "<<abs(itHit->particleType())<<" with energy " <<itHit->energyLoss(); 00139 } 00140 if (fabs(t)> dt1 || fabs(t) <dt2 ) continue; 00141 if (t>0) EnergyBX[id]+=itHit->energyLoss(); 00142 else EnergyBXMinusDt[id]+=itHit->energyLoss(); 00143 } 00144 for ( unsigned int ipad = 0 ; ipad<32; ipad++) { 00145 00146 if ( edm::isDebugEnabled() ) LogTrace("BSCTrig")<<" EnergyBX["<<ipad<<"]="<<EnergyBX[ipad]; 00147 00148 if ( EnergyBX[ipad] > theThreshold ) { 00149 if ( isZplus(ipad)) { 00150 if ( isInner(ipad) ) ZPinnerBX++; 00151 else ZPouterBX++; 00152 } else { 00153 if ( isInner(ipad) ) ZMinnerBX++; 00154 else ZMouterBX++; 00155 } 00156 } 00157 } 00158 if ( edm::isDebugEnabled() ) LogTrace("BSCTrig")<<" Zplus I="<<ZPinnerBX<<" Zminus I="<<ZMinnerBX<<" Zplus O="<<ZPouterBX<<" Zminus O="<<ZMouterBX; 00159 00160 //halo 00161 for ( unsigned i=0; i< ttBits_.size();++i ){ 00162 bool bit=false; 00163 if ( names_.at(i) == names_[0] ) { 00164 if ( EnergyBX[8] > theThreshold && EnergyBXMinusDt[27] > theThreshold ) bit=true; 00165 if ( EnergyBX[9] > theThreshold && EnergyBXMinusDt[26] > theThreshold ) bit=true; 00166 if ( EnergyBX[10] > theThreshold && EnergyBXMinusDt[25] > theThreshold ) bit=true; 00167 if ( EnergyBX[11] > theThreshold && EnergyBXMinusDt[24] > theThreshold ) bit=true; 00168 if ( EnergyBX[12] > theThreshold && EnergyBXMinusDt[31] > theThreshold ) bit=true; 00169 if ( EnergyBX[13] > theThreshold && EnergyBXMinusDt[30] > theThreshold ) bit=true; 00170 if ( EnergyBX[14] > theThreshold && EnergyBXMinusDt[29] > theThreshold ) bit=true; 00171 if ( EnergyBX[15] > theThreshold && EnergyBXMinusDt[28] > theThreshold ) bit=true; 00172 ttVec.at(i)=L1GtTechnicalTrigger(names_.at(i), ttBits_.at(i), 0, bit) ; 00173 } 00174 else if ( names_.at(i) == names_[1]) { 00175 if ( EnergyBX[0] > theThreshold && EnergyBXMinusDt[18] > theThreshold ) bit=true; 00176 if ( EnergyBX[1] > theThreshold && EnergyBXMinusDt[19] > theThreshold ) bit=true; 00177 if ( EnergyBX[2] > theThreshold && EnergyBXMinusDt[16] > theThreshold ) bit=true; 00178 if ( EnergyBX[3] > theThreshold && EnergyBXMinusDt[17] > theThreshold ) bit=true; 00179 if ( EnergyBX[4] > theThreshold && EnergyBXMinusDt[22] > theThreshold ) bit=true; 00180 if ( EnergyBX[5] > theThreshold && EnergyBXMinusDt[23] > theThreshold ) bit=true; 00181 if ( EnergyBX[6] > theThreshold && EnergyBXMinusDt[20] > theThreshold ) bit=true; 00182 if ( EnergyBX[7] > theThreshold && EnergyBXMinusDt[21] > theThreshold ) bit=true; 00183 ttVec.at(i)=L1GtTechnicalTrigger(names_.at(i), ttBits_.at(i), 0, bit) ; 00184 } 00185 else if ( names_.at(i) == names_[2]) { 00186 if ( EnergyBXMinusDt[8] > theThreshold && EnergyBX[27] > theThreshold ) bit=true; 00187 if ( EnergyBXMinusDt[9] > theThreshold && EnergyBX[26] > theThreshold ) bit=true; 00188 if ( EnergyBXMinusDt[10] > theThreshold && EnergyBX[25] > theThreshold ) bit=true; 00189 if ( EnergyBXMinusDt[11] > theThreshold && EnergyBX[24] > theThreshold ) bit=true; 00190 if ( EnergyBXMinusDt[12] > theThreshold && EnergyBX[31] > theThreshold ) bit=true; 00191 if ( EnergyBXMinusDt[13] > theThreshold && EnergyBX[30] > theThreshold ) bit=true; 00192 if ( EnergyBXMinusDt[14] > theThreshold && EnergyBX[29] > theThreshold ) bit=true; 00193 if ( EnergyBXMinusDt[15] > theThreshold && EnergyBX[28] > theThreshold ) bit=true; 00194 ttVec.at(i)=L1GtTechnicalTrigger(names_.at(i), ttBits_.at(i), 0, bit) ; 00195 } 00196 else if ( names_.at(i) == names_[3] ) { 00197 if ( EnergyBXMinusDt[0] > theThreshold && EnergyBX[18] > theThreshold ) bit=true; 00198 if ( EnergyBXMinusDt[1] > theThreshold && EnergyBX[19] > theThreshold ) bit=true; 00199 if ( EnergyBXMinusDt[2] > theThreshold && EnergyBX[16] > theThreshold ) bit=true; 00200 if ( EnergyBXMinusDt[3] > theThreshold && EnergyBX[17] > theThreshold ) bit=true; 00201 if ( EnergyBXMinusDt[4] > theThreshold && EnergyBX[22] > theThreshold ) bit=true; 00202 if ( EnergyBXMinusDt[5] > theThreshold && EnergyBX[23] > theThreshold ) bit=true; 00203 if ( EnergyBXMinusDt[6] > theThreshold && EnergyBX[20] > theThreshold ) bit=true; 00204 if ( EnergyBXMinusDt[7] > theThreshold && EnergyBX[21] > theThreshold ) bit=true; 00205 ttVec.at(i)=L1GtTechnicalTrigger(names_.at(i), ttBits_.at(i), 0, bit) ; 00206 } 00207 00208 // the minbias trigger 00209 else if ( names_.at(i) == names_[4] ){ 00210 if (ZPinnerBX > theNinner_ && ZMinnerBX > theNinner_ ) bit=true; 00211 ttVec.at(i)=L1GtTechnicalTrigger(names_.at(i), ttBits_.at(i), 0, bit); 00212 } 00213 else if ( names_.at(i) == names_[5] ) { 00214 if ( ZPouterBX > theNouter_ && ZMouterBX > theNouter_ ) bit=true; 00215 ttVec.at(i)=L1GtTechnicalTrigger(names_.at(i), ttBits_.at(i), 0, bit); 00216 } 00217 00218 if ( edm::isDebugEnabled() ) LogTrace("AnaBsc") << "bit: "<<ttBits_[i] << " VALUE:"<<bit ; 00219 00220 } 00221 } else ttVec.clear(); 00222 std::auto_ptr<L1GtTechnicalTriggerRecord> output(new L1GtTechnicalTriggerRecord()); 00223 output->setGtTechnicalTrigger(ttVec); 00224 iEvent.put(output); 00225 }
std::vector<std::string> BSCTrigger::names_ [private] |
int BSCTrigger::nevt_ [private] |
unsigned BSCTrigger::nEvt_ [private] |
Definition at line 55 of file BSCTrigger.cc.
float BSCTrigger::theCoincidence_ [private] |
edm::InputTag BSCTrigger::TheHits_tag_ [private] |
int BSCTrigger::theNinner_ [private] |
int BSCTrigger::theNouter_ [private] |
float BSCTrigger::theResolution_ [private] |
std::vector<unsigned> BSCTrigger::ttBits_ [private] |