36 if ( phiSize_ % 2 == 0 || etaSize_ % 2 == 0)
37 edm::LogError(
"AlCaElectronsProducerError") <<
"Size of eta/phi should be odd numbers";
48 produces< double > (
"weight") ;
74 if (!pElectrons.isValid()) {
85 bool barrelIsFull =
true ;
88 if (!barrelRecHitsHandle.isValid()) {
90 barrelIsFull =
false ;
95 barrelHitsCollection = barrelRecHitsHandle.product () ;
99 bool endcapIsFull =
true ;
102 if (!endcapRecHitsHandle.isValid()) {
104 endcapIsFull =
false ;
109 endcapHitsCollection = endcapRecHitsHandle.product () ;
114 bool preshowerIsFull =
true ;
117 if (!preshowerRecHitsHandle.isValid()) {
119 preshowerIsFull =
false ;
124 preshowerHitsCollection = preshowerRecHitsHandle.product () ;
127 set<ESDetId> used_strips;
134 std::auto_ptr< double >
weight (
new double(1));
139 reco::GsfElectronCollection::const_iterator eleIt;
144 if (fabs(eleIt->eta()) <= 1.479) {
150 double currEnergy = 0.;
152 std::vector<EBDetId> scXtals;
156 for(std::vector< std::pair<DetId, float> >::const_iterator idsIt = v1.begin();
157 idsIt != v1.end(); ++idsIt)
164 if((barrelHitsCollection->find( (*idsIt).first ))->
energy() > currEnergy) {
165 currEnergy=(barrelHitsCollection->find( (*idsIt).first ))->
energy();
166 maxHit=(*idsIt).first;
168 miniEBRecHitCollection->push_back(*(barrelHitsCollection->find( (*idsIt).first )));
169 scXtals.push_back( (*idsIt).first );
177 unsigned int column= icry %
etaSize_;
179 int curr_phi=maxHit.
iphi() + row - (phiSize_/2);
181 if (curr_eta * maxHit.
ieta() <= 0) {
if (maxHit.
ieta() > 0) curr_eta--;
else curr_eta++; }
182 if (curr_phi < 1) curr_phi += 360;
183 if (curr_phi > 360) curr_phi -= 360;
186 std::vector<EBDetId>::const_iterator usedIds;
188 bool HitAlreadyUsed=
false;
189 for(usedIds=scXtals.begin(); usedIds!=scXtals.end(); usedIds++)
197 if (barrelHitsCollection->find(det) != barrelHitsCollection->end())
198 miniEBRecHitCollection->push_back(*(barrelHitsCollection->find(det)));
208 double currEnergy = 0.;
210 vector<EEDetId> scXtals;
214 for(std::vector< std::pair<DetId, float> >::const_iterator idsIt = v1.begin();
215 idsIt != v1.end(); ++idsIt)
223 if((endcapHitsCollection->find( (*idsIt).first ))->
energy() > currEnergy)
225 currEnergy=(endcapHitsCollection->find( (*idsIt).first ))->
energy();
226 maxHit=(*idsIt).first;
228 miniEERecHitCollection->push_back (
229 *(endcapHitsCollection->find ( (*idsIt).first ))
231 scXtals.push_back ( (*idsIt).first ) ;
237 if (eleIt->eta () < 0) iz = -1 ;
240 for (
int icry = 0 ; icry < side*side ; icry++)
242 unsigned int row = icry / side ;
243 unsigned int column = icry % side ;
244 int curr_eta = maxHit.
ix () + column - (side/2);
245 int curr_phi = maxHit.
iy () + row - (side/2);
246 if ( curr_eta <= 0 || curr_phi <= 0
247 || curr_eta > 100 || curr_phi > 100 ) continue ;
250 if (
find (scXtals.begin (), scXtals.end (), det) != scXtals.end ())
251 if (endcapHitsCollection->find (det) != endcapHitsCollection->end ())
252 miniEERecHitCollection->push_back (*(endcapHitsCollection->find (det))) ;
259 double X = (*bc_iter)->x();
260 double Y = (*bc_iter)->y();
261 double Z = (*bc_iter)->z();
269 int esindexE1 = (tmp1 ==
DetId(0)) ? -1 : (strip1.
six()-1)*32+strip1.
strip();
270 int esindexE2 = (tmp2 ==
DetId(0)) ? -1 : (strip2.
siy()-1)*32+strip2.
strip();
274 for (esit = preshowerHitsCollection->begin(); esit != preshowerHitsCollection->end(); esit++) {
278 if (used_strips.find(esid) != used_strips.end())
continue;
282 esindexRh = (esid.
six()-1)*32+esid.
strip();
285 miniESRecHitCollection->push_back(*esit);
286 used_strips.insert(esid);
291 esindexRh = (esid.
siy()-1)*32+esid.
strip();
294 miniESRecHitCollection->push_back(*esit);
295 used_strips.insert(esid);
311 iEvent.
put( weight,
"weight");
const double Z[kNumberCalorimeter]
static bool validDetId(int i, int j)
check if a valid index combination
T getParameter(std::string const &) const
edm::InputTag eeRecHitsLabel_
std::string alcaPreshowerHitsCollection_
std::vector< T >::const_iterator const_iterator
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
int iphi() const
get the crystal iphi
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::InputTag electronLabel_
int ieta() const
get the crystal ieta
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
static const int ETAPHIMODE
virtual void produce(edm::Event &, const edm::EventSetup &)
producer
std::string alcaEndcapHitsCollection_
bool null() const
is this a null id ?
std::string alcaBarrelHitsCollection_
ESHandle< TrackerGeometry > geometry
AlCaElectronsProducer(const edm::ParameterSet &)
ctor
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
edm::InputTag ebRecHitsLabel_
edm::InputTag esRecHitsLabel_
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents