CMS 3D CMS Logo

L1RCTProducer Class Reference

#include <L1Trigger/RegionalCaloTrigger/interface/L1RCTProducer.h>

Inheritance diagram for L1RCTProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginJob (const edm::EventSetup &c)
 L1RCTProducer (const edm::ParameterSet &ps)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~L1RCTProducer ()

Private Attributes

edm::InputTag ecalDigisLabel
int hbShift
edm::InputTag hcalDigisLabel
int hfShift
unsigned postSamples
unsigned preSamples
L1RCTrct
L1RCTLookupTablesrctLookupTables
bool useDebugTpgScales
bool useEcal
bool useEcalCosmicTiming
bool useHcal
bool useHcalCosmicTiming
bool useMCAsInput


Detailed Description

Definition at line 20 of file L1RCTProducer.h.


Constructor & Destructor Documentation

L1RCTProducer::L1RCTProducer ( const edm::ParameterSet ps  )  [explicit]

Definition at line 38 of file L1RCTProducer.cc.

00038                                                         : 
00039   rctLookupTables(new L1RCTLookupTables),
00040   rct(new L1RCT(rctLookupTables)),
00041   useEcal(conf.getParameter<bool>("useEcal")),
00042   useHcal(conf.getParameter<bool>("useHcal")),
00043   ecalDigisLabel(conf.getParameter<edm::InputTag>("ecalDigisLabel")),
00044   hcalDigisLabel(conf.getParameter<edm::InputTag>("hcalDigisLabel")),
00045   useDebugTpgScales(conf.getParameter<bool>("useDebugTpgScales")),
00046   useHcalCosmicTiming(conf.getParameter<bool>("useHcalCosmicTiming")),
00047   useEcalCosmicTiming(conf.getParameter<bool>("useEcalCosmicTiming")),
00048   preSamples(conf.getParameter<unsigned>("preSamples")),
00049   postSamples(conf.getParameter<unsigned>("postSamples")),
00050   useMCAsInput(conf.getParameter<bool>("UseMCAsInput")),
00051   hfShift(conf.getParameter<int>("HFShift")),
00052   hbShift(conf.getParameter<int>("HBShift"))
00053 {
00054   produces<L1CaloEmCollection>();
00055   produces<L1CaloRegionCollection>();
00056 }

L1RCTProducer::~L1RCTProducer (  )  [virtual]

Definition at line 58 of file L1RCTProducer.cc.

References rct, and rctLookupTables.

00059 {
00060   if(rct != 0) delete rct;
00061   if(rctLookupTables != 0) delete rctLookupTables;
00062 }


Member Function Documentation

void L1RCTProducer::beginJob ( const edm::EventSetup c  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 64 of file L1RCTProducer.cc.

00065 {
00066 }

void L1RCTProducer::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 68 of file L1RCTProducer.cc.

References c, GenMuonPlsPt100GeV_cfg::cout, L1RCT::digiInput(), e, ReconstructionGR_cff::ecal, EcalBarrel, ecalDigisLabel, EcalEndcap, EcalTriggerTower, lat::endl(), edm::EventSetup::get(), L1RCT::getIsolatedEGObjects(), L1RCT::getNonisolatedEGObjects(), L1RCT::getRegions(), EcalTPGScale::getTPGInGeV(), h, hbShift, ReconstructionGR_cff::hcal, hcalDigisLabel, CaloTPGTranscoder::hcaletValue(), hfShift, i, edm::Handle< T >::isValid(), j, L1CaloEcalScale::nBinEta, L1CaloHcalScale::nBinEta, L1CaloHcalScale::nBinRank, L1CaloEcalScale::nBinRank, postSamples, preSamples, L1RCT::processEvent(), edm::ESHandle< T >::product(), r, rct, rctLookupTables, s, L1CaloHcalScale::setBin(), L1CaloEcalScale::setBin(), L1RCTLookupTables::setChannelMask(), L1RCTLookupTables::setEcalScale(), EcalTPGScale::setEventSetup(), L1RCTLookupTables::setHcalScale(), L1RCTLookupTables::setL1CaloEtScale(), HcalTriggerPrimitiveDigi::setPresamples(), L1RCTLookupTables::setRCTParameters(), EcalTriggerPrimitiveDigi::setSample(), HcalTriggerPrimitiveDigi::setSample(), EcalTriggerPrimitiveDigi::setSize(), HcalTriggerPrimitiveDigi::setSize(), useDebugTpgScales, useEcal, useEcalCosmicTiming, useHcal, useHcalCosmicTiming, and useMCAsInput.

00069 {
00070 
00071   // Refresh configuration information every event
00072   // Hopefully, this does not take too much time
00073   // There should be a call back function in future to
00074   // handle changes in configuration
00075 
00076   // parameters to configure RCT (thresholds, etc)
00077   edm::ESHandle<L1RCTParameters> rctParameters;
00078   eventSetup.get<L1RCTParametersRcd>().get(rctParameters);
00079   const L1RCTParameters* r = rctParameters.product();
00080 
00081   // list of RCT channels to mask
00082   edm::ESHandle<L1RCTChannelMask> channelMask;
00083   eventSetup.get<L1RCTChannelMaskRcd>().get(channelMask);
00084   const L1RCTChannelMask* c = channelMask.product();
00085   
00086   // energy scale to convert eGamma output
00087   edm::ESHandle<L1CaloEtScale> emScale;
00088   eventSetup.get<L1EmEtScaleRcd>().get(emScale);
00089   const L1CaloEtScale* s = emScale.product();
00090 
00091   rctLookupTables->setRCTParameters(r);
00092   rctLookupTables->setChannelMask(c);
00093   rctLookupTables->setL1CaloEtScale(s);
00094 
00095   // use these dummies to get the delete right when using old-style
00096   // scales to create set of L1CaloXcalScales
00097   L1CaloEcalScale* dummyE(0);
00098   L1CaloHcalScale* dummyH(0);
00099 
00100   if (useDebugTpgScales) // generate new-style scales from tpg scales
00101     {
00102 
00103       std::cout << "Using old-style TPG scales!" << endl;
00104 
00105       // old version of hcal energy scale to convert input
00106       edm::ESHandle<CaloTPGTranscoder> transcoder;
00107       eventSetup.get<CaloTPGRecord>().get(transcoder);
00108       const CaloTPGTranscoder* h_tpg = transcoder.product();
00109 
00110       // old version of ecal energy scale to convert input
00111       EcalTPGScale* e_tpg = new EcalTPGScale();
00112       e_tpg->setEventSetup(eventSetup);
00113 
00114       L1CaloEcalScale* ecalScale = new L1CaloEcalScale();
00115       L1CaloHcalScale* hcalScale = new L1CaloHcalScale();
00116 
00117       // generate L1CaloXcalScales from old-style scales (thanks, werner!)
00118       // ECAL
00119       //std::cout << "ECAL Pos " << L1CaloEcalScale::nBinRank << std::endl ;
00120       for( unsigned short ieta = 1 ; ieta <= L1CaloEcalScale::nBinEta; ++ieta )
00121         {
00122           for( unsigned short irank = 0 ; irank < L1CaloEcalScale::nBinRank; ++irank )
00123             {
00124               //std::cout << ieta << " " << irank ;
00125               EcalSubdetector subdet = ( ieta <= 17 ) ? EcalBarrel : EcalEndcap ;
00126               double etGeVPos =
00127                 e_tpg->getTPGInGeV
00128                 ( irank, EcalTrigTowerDetId(1, // +ve eta
00129                                             subdet,
00130                                             ieta,
00131                                             1 )); // dummy phi value
00132               ecalScale->setBin( irank, ieta, 1, etGeVPos ) ;
00133               //std::cout << etGeVPos << ", " ;
00134             }
00135           //std::cout << std::endl ;
00136         }
00137       //std::cout << std::endl ;
00138       
00139       //std::cout << "ECAL Neg" << std::endl ;
00140       for( unsigned short ieta = 1 ; ieta <= L1CaloEcalScale::nBinEta; ++ieta )
00141         {
00142           for( unsigned short irank = 0 ; irank < L1CaloEcalScale::nBinRank; ++irank )
00143             {
00144               EcalSubdetector subdet = ( ieta <= 17 ) ? EcalBarrel : EcalEndcap ;
00145               
00146               //std::cout << ieta << " " << irank ;
00147               double etGeVNeg =
00148                 e_tpg->getTPGInGeV
00149                 ( irank,
00150                   EcalTrigTowerDetId(-1, // -ve eta
00151                                      subdet,
00152                                      ieta,
00153                                      2 )); // dummy phi value
00154               ecalScale->setBin( irank, ieta, -1, etGeVNeg ) ;
00155               //std::cout << etGeVNeg << ", " ;
00156             }
00157           //std::cout << std::endl ;
00158         }
00159       //std::cout << std::endl ;
00160 
00161       // HCAL
00162       //std::cout << "HCAL" << std::endl ;
00163       for( unsigned short ieta = 1 ; ieta <= L1CaloHcalScale::nBinEta; ++ieta )
00164         {
00165           for( unsigned short irank = 0 ; irank < L1CaloHcalScale::nBinRank; ++irank )
00166             {
00167               double etGeV = h_tpg->hcaletValue( ieta, irank ) ;
00168 
00169               hcalScale->setBin( irank, ieta, 1, etGeV ) ;
00170               hcalScale->setBin( irank, ieta, -1, etGeV ) ;
00171               //std::cout << etGeV << ", " ;
00172             }
00173           //std::cout << std::endl ;
00174         }
00175       //std::cout << std::endl ;
00176 
00177       // set the input scales
00178       rctLookupTables->setEcalScale(ecalScale);
00179       rctLookupTables->setHcalScale(hcalScale);
00180 
00181       dummyE = ecalScale;
00182       dummyH = hcalScale;
00183 
00184       delete e_tpg;
00185 
00186     }
00187   else
00188     {
00189 
00190       // get energy scale to convert input from ECAL
00191       edm::ESHandle<L1CaloEcalScale> ecalScale;
00192       eventSetup.get<L1CaloEcalScaleRcd>().get(ecalScale);
00193       const L1CaloEcalScale* e = ecalScale.product();
00194       
00195       // get energy scale to convert input from HCAL
00196       edm::ESHandle<L1CaloHcalScale> hcalScale;
00197       eventSetup.get<L1CaloHcalScaleRcd>().get(hcalScale);
00198       const L1CaloHcalScale* h = hcalScale.product();
00199 
00200       // set scales
00201       rctLookupTables->setEcalScale(e);
00202       rctLookupTables->setHcalScale(h);
00203 
00204     }
00205 
00206   edm::Handle<EcalTrigPrimDigiCollection> ecal;
00207   edm::Handle<HcalTrigPrimDigiCollection> hcal;
00208   
00209   EcalTrigPrimDigiCollection::const_iterator ecal_it;
00210   HcalTrigPrimDigiCollection::const_iterator hcal_it;
00211 
00212   if (useEcal) { event.getByLabel(ecalDigisLabel, ecal); }
00213   if (useHcal) { event.getByLabel(hcalDigisLabel, hcal); }
00214 
00215   unsigned nSamples = preSamples + postSamples + 1;
00216   //std::cout << "pre " << preSamples << " post " << postSamples
00217   //        << " total " << nSamples << std::endl;
00218 
00219   bool tooLittleDataEcal = false;
00220   bool tooLittleDataHcal = false;
00221 
00222   std::vector<EcalTrigPrimDigiCollection> ecalColl(nSamples);
00223   std::vector<HcalTrigPrimDigiCollection> hcalColl(nSamples);
00224   if (ecal.isValid()) 
00225     { 
00226       // loop through all ecal digis
00227       for (ecal_it = ecal->begin(); ecal_it != ecal->end(); ecal_it++)
00228         {
00229           short zside = ecal_it->id().zside();
00230           unsigned short ietaAbs = ecal_it->id().ietaAbs();
00231           short iphi = ecal_it->id().iphi();
00232           /*
00233           if (ecal_it->compressedEt() > 0)
00234             {
00235               std::cout << "[Producer] ecal tower energy is " 
00236                         << ecal_it->compressedEt() << std::endl;
00237             }
00238           */
00239           // loop through requested time samples for each digi
00240           unsigned short digiSize = ecal_it->size();
00241           // (size of each digi must be no less than nSamples)
00242           unsigned short nSOI = (unsigned short) ( ecal_it->
00243                                                    sampleOfInterest() );
00244           if (digiSize < nSamples || nSOI < preSamples
00245               || ((digiSize - nSOI) < (nSamples - preSamples)))
00246             {
00247               // log error -- should not happen!
00248               if (tooLittleDataEcal == false)
00249                 {
00250                   edm::LogWarning ("TooLittleData")
00251                     << "ECAL data should have at least " << nSamples
00252                     << " time samples per digi, current digi has " 
00253                     << digiSize << ".  Insufficient data to process "
00254                     << "requested bx's.  Filling extra with zeros";
00255                   tooLittleDataEcal = true;
00256                 }
00257               unsigned short preLoopsZero = (unsigned short) (preSamples) 
00258                 - nSOI;
00259               unsigned short postLoopsZero = (unsigned short) (postSamples)
00260                 - (digiSize - nSOI - 1);
00261               
00262               // fill extra bx's at beginning with zeros
00263               for (int sample = 0; sample < preLoopsZero; sample++)
00264                 {
00265                   // fill first few with zeros
00266                   EcalTriggerPrimitiveDigi
00267                     ecalDigi(EcalTrigTowerDetId((int) zside, EcalTriggerTower,
00268                                                 (int) ietaAbs, (int) iphi));
00269                   ecalDigi.setSize(1);
00270                   ecalDigi.setSample(0, EcalTriggerPrimitiveSample(0,false,0));
00271                   ecalColl[sample].push_back(ecalDigi);
00272                 }
00273 
00274               // loop through existing data
00275               for (int sample = preLoopsZero; 
00276                    sample < (preLoopsZero + digiSize); sample++)
00277                 {
00278                   // go through data
00279                   EcalTriggerPrimitiveDigi
00280                     ecalDigi(EcalTrigTowerDetId((int) zside, EcalTriggerTower,
00281                                                 (int) ietaAbs, (int) iphi));
00282                   ecalDigi.setSize(1);
00283 
00284                   if (useEcalCosmicTiming && iphi >= 1 && iphi <= 36)
00285                     {
00286                       if (nSOI < (preSamples + 1))
00287                         {
00288                           edm::LogWarning ("TooLittleData")
00289                             << "ECAL data needs at least one presample "
00290                             << "more than the number requested "
00291                             << "to use ecal cosmic timing mod!  "
00292                             //<< "Setting data "
00293                             //<< "for this time slice to zero and "
00294                             << "reverting to useEcalCosmicTiming = false "
00295                             << "for rest of job.";
00296                           //ecalDigi.setSample(0, EcalTriggerPrimitiveSample
00297                           //                 (0, false, 0));
00298                           useEcalCosmicTiming = false;
00299                         }
00300                       else
00301                         {
00302                           // take data from one crossing earlier
00303                           ecalDigi.setSample(0, EcalTriggerPrimitiveSample
00304                                              (ecal_it->sample(nSOI + sample - 
00305                                                               preSamples - 
00306                                                               1).raw()));
00307                         }
00308                     }
00309                   //else
00310                   if ((!useEcalCosmicTiming) || (iphi >=37 && iphi <= 72))
00311                     {
00312                       ecalDigi.setSample(0, EcalTriggerPrimitiveSample
00313                                          (ecal_it->sample(nSOI + sample - 
00314                                                           preSamples).raw()));
00315                     }
00316                   ecalColl[sample].push_back(ecalDigi);
00317                   /*
00318                   if (ecal_it->sample(sample).compressedEt() > 0)
00319                     {
00320                       std::cout << "[Producer] ecal tower energy is "
00321                       << ecal_it->sample(sample).compressedEt()
00322                       << " in sample " << sample << std::endl;
00323                     }
00324                   */
00325                 }
00326               
00327               // fill extra bx's at end with zeros
00328               for (int sample = (preLoopsZero + digiSize); 
00329                    sample < nSamples; sample++)
00330                 {
00331                   // fill zeros!
00332                   EcalTriggerPrimitiveDigi
00333                     ecalDigi(EcalTrigTowerDetId((int) zside, EcalTriggerTower,
00334                                                 (int) ietaAbs, (int) iphi));
00335                   ecalDigi.setSize(1);
00336                   ecalDigi.setSample(0, EcalTriggerPrimitiveSample(0,false,0));
00337                   ecalColl[sample].push_back(ecalDigi);
00338                 }
00339             }
00340           else
00341             {
00342               for (unsigned short sample = 0; sample < nSamples; sample++)
00343                 {
00344                   /*
00345                   if (ecal_it->sample(sample).compressedEt() > 0)
00346                     {
00347                       std::cout << "[Producer] ecal tower energy is "
00348                                 << ecal_it->sample(sample).compressedEt()
00349                                 << " in sample " << sample << std::endl;
00350                     }
00351                   */
00352                   // put each time sample into its own digi
00353                   short zside = ecal_it->id().zside();
00354                   unsigned short ietaAbs = ecal_it->id().ietaAbs();
00355                   short iphi = ecal_it->id().iphi();
00356                   EcalTriggerPrimitiveDigi
00357                     ecalDigi(EcalTrigTowerDetId((int) zside, EcalTriggerTower,
00358                                                 (int) ietaAbs, (int) iphi));
00359                   ecalDigi.setSize(1);
00360 
00361                   if (useEcalCosmicTiming && iphi >= 1 && iphi <=36)
00362                     {
00363                       if (nSOI < (preSamples + 1))
00364                         {
00365                           edm::LogWarning ("TooLittleData")
00366                             << "ECAL data needs at least one presample "
00367                             << "more than the number requested "
00368                             << "to use ecal cosmic timing mod!  "
00369                             //<< "Setting data "
00370                             //<< "for this time slice to zero and "
00371                             << "reverting to useEcalCosmicTiming = false "
00372                             << "for rest of job.";
00373                           //ecalDigi.setSample(0, EcalTriggerPrimitiveSample
00374                           //         (0, false, 0));
00375                           useEcalCosmicTiming = false;
00376                         }
00377                       else
00378                         {
00379                           ecalDigi.setSample(0, EcalTriggerPrimitiveSample
00380                                              (ecal_it->sample
00381                                               (ecal_it->sampleOfInterest() + 
00382                                                sample - preSamples - 
00383                                                1).raw()));
00384                         }
00385                     }
00386                   //else
00387                   if ((!useEcalCosmicTiming) || (iphi >=37 && iphi <= 72))
00388                     {
00389                       ecalDigi.setSample(0, EcalTriggerPrimitiveSample
00390                                          (ecal_it->sample
00391                                           (ecal_it->sampleOfInterest() + 
00392                                            sample - preSamples).raw()));
00393                     }
00394                   // push back each digi into correct "time sample" of coll
00395                   ecalColl[sample].push_back(ecalDigi);
00396                 }
00397             }
00398         }
00399     }
00400   if (hcal.isValid()) 
00401     { 
00402       // loop through all hcal digis
00403       for (hcal_it = hcal->begin(); hcal_it != hcal->end(); hcal_it++)
00404         {
00405           short ieta = hcal_it->id().ieta();
00406           short iphi = hcal_it->id().iphi();
00407           // loop through time samples for each digi
00408           unsigned short digiSize = hcal_it->size();
00409           // (size of each digi must be no less than nSamples)
00410           unsigned short nSOI = (unsigned short) (hcal_it->presamples());
00411           if (digiSize < nSamples || nSOI < preSamples
00412               || ((digiSize - nSOI) < (nSamples - preSamples)))
00413             {
00414               // log error -- should not happen!
00415               if (tooLittleDataHcal == false)
00416                 {
00417                   edm::LogWarning ("TooLittleData")
00418                     << "HCAL data should have at least " << nSamples
00419                     << " time samples per digi, current digi has " 
00420                     << digiSize << ".  Insufficient data to process "
00421                     << "requested bx's.  Filling extra with zeros";
00422                   tooLittleDataHcal = true;
00423                 }
00424               unsigned short preLoopsZero = (unsigned short) (preSamples) 
00425                 - nSOI;
00426               unsigned short postLoopsZero = (unsigned short) (postSamples)
00427                 - (digiSize - nSOI - 1);
00428               
00429               // fill extra bx's at beginning with zeros
00430               for (int sample = 0; sample < preLoopsZero; sample++)
00431                 {
00432                   // fill first few with zeros
00433                   HcalTriggerPrimitiveDigi
00434                     hcalDigi(HcalTrigTowerDetId((int) ieta, (int) iphi));
00435                   hcalDigi.setSize(1);
00436                   hcalDigi.setPresamples(0);
00437                   hcalDigi.setSample(0, HcalTriggerPrimitiveSample(0,false,0,0));
00438                   hcalColl[sample].push_back(hcalDigi);
00439                 }
00440 
00441               // loop through existing data
00442               for (int sample = preLoopsZero; 
00443                    sample < (preLoopsZero + digiSize); sample++)
00444                 {
00445                   // go through data
00446                   HcalTriggerPrimitiveDigi
00447                     hcalDigi(HcalTrigTowerDetId((int) ieta, (int) iphi));
00448                   hcalDigi.setSize(1);
00449                   hcalDigi.setPresamples(0);
00450 
00451                   // for cosmics, hcal data from upper half of det
00452                   // comes 1 bx before data from bottom half
00453                   // SHOULDN'T ever go out of bounds (typically >=1 presample)
00454                   // but if 0 presamples, sets useHcalCosmicTiming = false
00455                   /*
00456                   std::cout << "[producer] useHcalCosmicTiming=" 
00457                             << useHcalCosmicTiming
00458                             << " iphi=" << iphi << " hcal presamples="
00459                             << hcal_it->presamples()
00460                             << std::endl;
00461                   */
00462                   if (useHcalCosmicTiming && iphi >= 1 && iphi <= 36)
00463                     {
00464                       if (nSOI < (preSamples + 1))
00465                         {
00466                           edm::LogWarning ("TooLittleData")
00467                             << "HCAL data needs at least one presample "
00468                             << "more than the number requested "
00469                             << "to use hcal cosmic timing mod!  "
00470                             //<< "Setting data "
00471                             //<< "for this time slice to zero and "
00472                             << "reverting to useHcalCosmicTiming = false "
00473                             << "for rest of job.";
00474                           //hcalDigi.setSample(0, HcalTriggerPrimitiveSample
00475                           //                 (0, false, 0, 0));
00476                           useHcalCosmicTiming = false;
00477                         }
00478                       else
00479                         {
00480                           hcalDigi.setSample(0, HcalTriggerPrimitiveSample
00481                                              (hcal_it->sample(hcal_it->
00482                                                               presamples() + 
00483                                                               sample - 
00484                                                               preSamples - 
00485                                                               1).raw()));
00486                         }
00487                     }
00488                   //else
00489                   if ((!useHcalCosmicTiming) || (iphi >= 37 && iphi <= 72))
00490                     {
00491 
00492                       //If it is MC keep as it is
00493 //                    if(useMCAsInput)
00494 //                      {
00495                           hcalDigi.setSample(0, HcalTriggerPrimitiveSample
00496                                              (hcal_it->sample(hcal_it->
00497                                                               presamples() + 
00498                                                               sample - 
00499                                                               preSamples).raw()));
00500 /*                      }
00501                       else //It is data 
00502                         {
00503                           if(ieta>-29 && ieta<29) 
00504                             hcalDigi.setSample(0, HcalTriggerPrimitiveSample
00505                                                (hcal_it->sample(hcal_it->
00506                                                               presamples() + 
00507                                                                 sample - 
00508                                                                 preSamples+hbShift).raw()));
00509                           if(ieta<=-29 || ieta>=29)
00510                             hcalDigi.setSample(0, HcalTriggerPrimitiveSample
00511                                                (hcal_it->sample(hcal_it->
00512                                                               presamples() + 
00513                                                                 sample - 
00514                                                                 preSamples+hfShift).raw()));
00515 
00516                         }
00517 */
00518                     }
00519                   hcalColl[sample].push_back(hcalDigi);
00520                 }
00521               
00522               // fill extra bx's at end with zeros
00523               for (int sample = (preLoopsZero + digiSize); 
00524                    sample < nSamples; sample++)
00525                 {
00526                   // fill zeros!
00527                   HcalTriggerPrimitiveDigi
00528                     hcalDigi(HcalTrigTowerDetId((int) ieta, (int) iphi));
00529                   hcalDigi.setSize(1);
00530                   hcalDigi.setPresamples(0);
00531                   hcalDigi.setSample(0, HcalTriggerPrimitiveSample(0,false,0,0));
00532                   hcalColl[sample].push_back(hcalDigi);
00533                 }
00534             }
00535           else
00536             {
00537               for (unsigned short sample = 0; sample < nSamples; sample++)
00538                 {
00539                   // put each (relevant) time sample into its own digi
00540                   HcalTriggerPrimitiveDigi hcalDigi(HcalTrigTowerDetId(
00541                                                     (int) ieta, (int) iphi));
00542                   hcalDigi.setSize(1);
00543                   hcalDigi.setPresamples(0);
00544 
00545                   // for cosmics, hcal data from upper half of det
00546                   // comes 1 bx before data from bottom half
00547                   // SHOULDN'T ever go out of bounds (typically >=1 presample)
00548                   // but if 0 presamples, sets useHcalCosmicTiming = false
00549                   /*
00550                   std::cout << "[producer] useHcalCosmicTiming=" 
00551                             << useHcalCosmicTiming
00552                             << " iphi=" << iphi << " hcal presamples="
00553                             << hcal_it->presamples() << " no extra zeros"
00554                             << std::endl;
00555                   */
00556                   if (useHcalCosmicTiming && iphi >= 1 && iphi <= 36)
00557                     {
00558                       if (nSOI < (preSamples + 1))
00559                         {
00560                           edm::LogWarning ("TooLittleData")
00561                             << "HCAL data needs at least one presample "
00562                             << "more than the number requested "
00563                             << "to use hcal cosmic timing mod!  "
00564                             //<< "Setting data "
00565                             //<< "for this time slice to zero and "
00566                             << "reverting to useHcalCosmicTiming = false "
00567                             << "for rest of job.";
00568                           //hcalDigi.setSample(0, HcalTriggerPrimitiveSample
00569                           //                 (0, false, 0, 0));
00570                           useHcalCosmicTiming = false;
00571                         }
00572                       else
00573                         {
00574                           hcalDigi.setSample(0, HcalTriggerPrimitiveSample
00575                                              (hcal_it->sample(hcal_it->
00576                                                               presamples() + 
00577                                                               sample - 
00578                                                               preSamples - 
00579                                                               1).raw()));
00580                         }
00581                     }
00582                   //else
00583                   if ((!useHcalCosmicTiming) || (iphi >= 37 && iphi <= 72))
00584                     {
00585 //                    hcalDigi.setSample(0, HcalTriggerPrimitiveSample
00586 //                                       (hcal_it->sample(hcal_it->
00587 //                                                        presamples() + 
00588 //                                                        sample - 
00589 //                                                        preSamples).raw()));
00590                       //If it is MC keep as it is
00591                       if(useMCAsInput)
00592                         {
00593                           hcalDigi.setSample(0, HcalTriggerPrimitiveSample
00594                                              (hcal_it->sample(hcal_it->
00595                                                               presamples() + 
00596                                                               sample - 
00597                                                               preSamples).raw()));
00598                         }
00599                       else //It is data 
00600                         {
00601                           if(ieta>-29 && ieta<29) 
00602                             hcalDigi.setSample(0, HcalTriggerPrimitiveSample
00603                                                (hcal_it->sample(hcal_it->
00604                                                               presamples() + 
00605                                                                 sample - 
00606                                                                 preSamples+hbShift).raw()));
00607                           if(ieta<=-29 || ieta>=29)
00608                             hcalDigi.setSample(0, HcalTriggerPrimitiveSample
00609                                                (hcal_it->sample(hcal_it->
00610                                                               presamples() + 
00611                                                                 sample - 
00612                                                                 preSamples+hfShift).raw()));
00613 
00614                         }
00615                     }
00616                   hcalColl[sample].push_back(hcalDigi);  
00617                 }
00618             }
00619         }
00620     }
00621 
00622   std::auto_ptr<L1CaloEmCollection> rctEmCands (new L1CaloEmCollection);
00623   std::auto_ptr<L1CaloRegionCollection> rctRegions (new L1CaloRegionCollection);
00624 
00625   // loop through and process each bx
00626   for (unsigned short sample = 0; sample < nSamples; sample++)
00627     {
00628       rct->digiInput(ecalColl[sample], hcalColl[sample]);
00629       rct->processEvent();
00630 
00631       // Stuff to create
00632       
00633       for (int j = 0; j<18; j++)
00634         {
00635           L1CaloEmCollection isolatedEGObjects = rct->getIsolatedEGObjects(j);
00636           L1CaloEmCollection nonisolatedEGObjects = rct->getNonisolatedEGObjects(j);
00637           for (int i = 0; i<4; i++) 
00638             {
00639               isolatedEGObjects.at(i).setBx(sample - preSamples);
00640               nonisolatedEGObjects.at(i).setBx(sample - preSamples);
00641               rctEmCands->push_back(isolatedEGObjects.at(i));
00642               rctEmCands->push_back(nonisolatedEGObjects.at(i));
00643             }
00644         }
00645       
00646       
00647       for (int i = 0; i < 18; i++)
00648         {
00649           vector<L1CaloRegion> regions = rct->getRegions(i);
00650           for (int j = 0; j < 22; j++)
00651             {
00652               regions.at(j).setBx(sample - preSamples);
00653               rctRegions->push_back(regions.at(j));
00654             }
00655         }
00656     }
00657   
00658   //putting stuff back into event
00659   event.put(rctEmCands);
00660   event.put(rctRegions);
00661 
00662   if (dummyE != 0) delete dummyE;
00663   if (dummyH != 0) delete dummyH;
00664 
00665 }


Member Data Documentation

edm::InputTag L1RCTProducer::ecalDigisLabel [private]

Definition at line 32 of file L1RCTProducer.h.

Referenced by produce().

int L1RCTProducer::hbShift [private]

Definition at line 46 of file L1RCTProducer.h.

Referenced by produce().

edm::InputTag L1RCTProducer::hcalDigisLabel [private]

Definition at line 33 of file L1RCTProducer.h.

Referenced by produce().

int L1RCTProducer::hfShift [private]

Definition at line 45 of file L1RCTProducer.h.

Referenced by produce().

unsigned L1RCTProducer::postSamples [private]

Definition at line 40 of file L1RCTProducer.h.

Referenced by produce().

unsigned L1RCTProducer::preSamples [private]

Definition at line 39 of file L1RCTProducer.h.

Referenced by produce().

L1RCT* L1RCTProducer::rct [private]

Definition at line 29 of file L1RCTProducer.h.

Referenced by produce(), and ~L1RCTProducer().

L1RCTLookupTables* L1RCTProducer::rctLookupTables [private]

Definition at line 28 of file L1RCTProducer.h.

Referenced by produce(), and ~L1RCTProducer().

bool L1RCTProducer::useDebugTpgScales [private]

Definition at line 36 of file L1RCTProducer.h.

Referenced by produce().

bool L1RCTProducer::useEcal [private]

Definition at line 30 of file L1RCTProducer.h.

Referenced by produce().

bool L1RCTProducer::useEcalCosmicTiming [private]

Definition at line 38 of file L1RCTProducer.h.

Referenced by produce().

bool L1RCTProducer::useHcal [private]

Definition at line 31 of file L1RCTProducer.h.

Referenced by produce().

bool L1RCTProducer::useHcalCosmicTiming [private]

Definition at line 37 of file L1RCTProducer.h.

Referenced by produce().

bool L1RCTProducer::useMCAsInput [private]

Definition at line 44 of file L1RCTProducer.h.

Referenced by produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:26:58 2009 for CMSSW by  doxygen 1.5.4