CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CalorimetryManager.cc
Go to the documentation of this file.
1 //Framework headers
4 
5 // Fast Simulation headers
20 //#include "FastSimulation/Utilities/interface/Histos.h"
30 // New headers for Muon Mip Simulation
33 // Muon Brem
35 
36 //Gflash Hadronic Model
44 // STL headers
45 #include <vector>
46 #include <iostream>
47 
48 //DQM
52 
53 //CMSSW headers
56 //#include "DataFormats/EcalDetId/interface/EcalDetId.h"
57 
59 
60 using namespace edm;
61 
64 
65 std::vector<std::pair<int,float> > CalorimetryManager::myZero_ = std::vector<std::pair<int,float> >
66 (1,std::pair<int,float>(0,0.));
67 
69  myCalorimeter_(0),
70  // myHistos(0),
71  random(0),initialized_(false)
72 {;}
73 
75  const edm::ParameterSet& fastCalo,
76  const edm::ParameterSet& fastMuECAL,
77  const edm::ParameterSet& fastMuHCAL,
78  const edm::ParameterSet& parGflash,
79  const RandomEngine* engine)
80  :
81  mySimEvent(aSimEvent),
82  random(engine), initialized_(false),
83  theMuonEcalEffects(0), theMuonHcalEffects (0), bFixedLength_(false)
84 
85 {
86 
89 
90  //Gflash
91  theProfile = new GflashHadronShowerProfile(parGflash);
92  thePiKProfile = new GflashPiKShowerProfile(parGflash);
95 
96  readParameters(fastCalo);
97 
98 // EBMapping_.resize(62000,myZero_);
99 // EEMapping_.resize(20000,myZero_);
100 // HMapping_.resize(10000,myZero_);
101  EBMapping_.resize(62000);
102  EEMapping_.resize(20000);
103  HMapping_.resize(10000);
104  theDetIds_.resize(10000);
105 
106  unsigned s=(unfoldedMode_)?5:1;
107  for(unsigned ic=0;ic<62000;++ic)
108  {
109  EBMapping_[ic].reserve(s);
110  if(ic<20000)
111  EEMapping_[ic].reserve(s);
112  if(ic<10000)
113  HMapping_[ic].reserve(s);
114  }
115 
116  // myHistos = 0;
117 
119 
120  if (useDQM_){
121  dbe->setCurrentFolder("EMShower");
122  // please keep the binning with fixed width and coherent between ShapeRhoZ and Tr/Lo shapes. Also check if you
123  // change the binning that the weight changes in the filling in EMShower.cc
124  dbe->book1D("TransverseShape","Transverse Shape; #rho / Moliere radius; 1/E dE/d#rho",70, 0., 7.);
125  dbe->book1D("LongitudinalShape","Longitudinal Shape; z / X0; 1/E dE/dz",26, 0.01, 26.01);
126  dbe->book2D("ShapeRhoZ","2D Shape Ee = 10 GeV; #rho / Moliere radius; z / X0",70, 0., 7., 26, 0.01, 26.01);
127 
128  dbe->book1D("NumberOfParticles","Number Of Particles entering the Shower; #Particles; #Events", 6, -0.5, 5.5);
129 
130  dbe->book1D("ParticlesEnergy","Log Particles Energy; log10(E / GeV); #Particles", 30, 0, 3);
131  }
132 
133 // myHistos = Histos::instance();
134 // myHistos->book("h10",140,-3.5,3.5,100,-0.5,99.5);
135 // myHistos->book("h20",150,0,150.,100,-0.5,99.5);
136 // myHistos->book("h100",140,-3.5,3.5,100,0,0.1);
137 // myHistos->book("h110",140,-3.5,3.5,100,0,10.);
138 // myHistos->book("h120",200,-5.,5.,100,0,0.5);
139 
140 // myHistos->book("h200",300,0,3.,100,0.,35.);
141 // myHistos->book("h210",720,-M_PI,M_PI,100,0,35.);
142 // myHistos->book("h212",720,-M_PI,M_PI,100,0,35.);
143 
144 // myHistos->bookByNumber("h30",0,7,300,-3.,3.,100,0.,35.);
145 // myHistos->book("h310",75,-3.,3.,"");
146 // myHistos->book("h400",100,-10.,10.,100,0.,35.);
147 // myHistos->book("h410",720,-M_PI,M_PI);
148 
149  myCalorimeter_ =
150  new CaloGeometryHelper(fastCalo);
151  myHDResponse_ =
152  new HCALResponse(fastCalo.getParameter<edm::ParameterSet>("HCALResponse"),
153  random);
154  myHSParameters_ =
155  new HSParameters(fastCalo.getParameter<edm::ParameterSet>("HSParameters"));
156 
157  // Material Effects for Muons in ECAL (only EnergyLoss implemented so far)
158 
159  if ( fastMuECAL.getParameter<bool>("PairProduction") ||
160  fastMuECAL.getParameter<bool>("Bremsstrahlung") ||
161  fastMuECAL.getParameter<bool>("MuonBremsstrahlung") ||
162  fastMuECAL.getParameter<bool>("EnergyLoss") ||
163  fastMuECAL.getParameter<bool>("MultipleScattering") )
164  theMuonEcalEffects = new MaterialEffects(fastMuECAL,random);
165 
166  // Material Effects for Muons in HCAL (only EnergyLoss implemented so far)
167 
168  if ( fastMuHCAL.getParameter<bool>("PairProduction") ||
169  fastMuHCAL.getParameter<bool>("Bremsstrahlung") ||
170  fastMuHCAL.getParameter<bool>("MuonBremsstrahlung") ||
171  fastMuHCAL.getParameter<bool>("EnergyLoss") ||
172  fastMuHCAL.getParameter<bool>("MultipleScattering") )
173  theMuonHcalEffects = new MaterialEffects(fastMuHCAL,random);
174 
175 
176 }
177 
179 {
180  unsigned size=firedCellsEB_.size();
181  for(unsigned ic=0;ic<size;++ic)
182  {
183  EBMapping_[firedCellsEB_[ic]].clear();
184  }
185  firedCellsEB_.clear();
186 
187  size=firedCellsEE_.size();
188  for(unsigned ic=0;ic<size;++ic)
189  {
190  EEMapping_[firedCellsEE_[ic]].clear();
191  }
192  firedCellsEE_.clear();
193 
194  size=firedCellsHCAL_.size();
195  for(unsigned ic=0;ic<size;++ic)
196  {
197  HMapping_[firedCellsHCAL_[ic]].clear();
198  }
199  firedCellsHCAL_.clear();
200 
201  ESMapping_.clear();
202  muonSimTracks.clear();
203 }
204 
206 {
207  if(myCalorimeter_) delete myCalorimeter_;
208  if(myHDResponse_) delete myHDResponse_;
209 
212 
213  if ( theProfile ) delete theProfile;
214 }
215 
217 {
218 
219  if(evtsToDebug_.size())
220  {
221  std::vector<unsigned int>::const_iterator itcheck=find(evtsToDebug_.begin(),evtsToDebug_.end(),mySimEvent->id().event());
222  debug_=(itcheck!=evtsToDebug_.end());
223  if(debug_)
224  mySimEvent->print();
225  }
226  // Clear the content of the calorimeters
227  if(!initialized_)
228  {
230  for(int subdetn=1;subdetn<=4;++subdetn)
231  {
232  const std::vector<DetId>& ids(geom->getValidDetIds(DetId::Hcal,subdetn));
233  for (std::vector<DetId>::const_iterator i=ids.begin(); i!=ids.end(); i++)
234  {
235  HcalDetId myDetId(*i);
236  unsigned hi=myDetId.hashed_index();
237  theDetIds_[hi]=myDetId;
238  }
239  }
240 
241  // Check if the preshower is really available
243  {
244  std::cout << " WARNING " << std::endl;
245  std::cout << " The preshower simulation has been turned on; but no preshower geometry is available " << std::endl;
246  std::cout << " Disabling the preshower simulation " << std::endl;
247  simulatePreshower_ = false;
248  }
249 
250  initialized_=true;
251  }
252  clean();
253 
254  LogInfo("FastCalorimetry") << "Reconstructing " << (int) mySimEvent->nTracks() << " tracks." << std::endl;
255  for( int fsimi=0; fsimi < (int) mySimEvent->nTracks() ; ++fsimi) {
256 
257  FSimTrack& myTrack = mySimEvent->track(fsimi);
258 
259  int pid = abs(myTrack.type());
260 
261  if (debug_) {
262  LogDebug("FastCalorimetry") << " ===> pid = " << pid << std::endl;
263  }
264 
265 
266  // Check that the particle hasn't decayed
267  if(myTrack.noEndVertex()) {
268  // Simulate energy smearing for photon and electrons
269  if ( pid == 11 || pid == 22 ) {
270 
271 
272  if ( myTrack.onEcal() )
273  EMShowerSimulation(myTrack);
274  else if ( myTrack.onVFcal() )
275  reconstructHCAL(myTrack);
276 
277  } // electron or photon
278  else if (pid==13)
279  {
280  MuonMipSimulation(myTrack);
281  }
282  // Simulate energy smearing for hadrons (i.e., everything
283  // but muons... and SUSY particles that deserve a special
284  // treatment.
285  else if ( pid < 1000000 ) {
286  if ( myTrack.onHcal() || myTrack.onVFcal() ) {
287  if(optionHDSim_ == 0 ) reconstructHCAL(myTrack);
288  else HDShowerSimulation(myTrack);
289  }
290  } // pid < 1000000
291  } // myTrack.noEndVertex()
292  } // particle loop
293  // LogInfo("FastCalorimetry") << " Number of hits (barrel)" << EBMapping_.size() << std::endl;
294  // LogInfo("FastCalorimetry") << " Number of hits (Hcal)" << HMapping_.size() << std::endl;
295  // std::cout << " Nombre de hit (endcap)" << EEMapping_.size() << std::endl;
296 
297 } // reconstruct
298 
299 // Simulation of electromagnetic showers in PS, ECAL, HCAL
301  std::vector<const RawParticle*> thePart;
302  double X0depth;
303  if (debug_) {
304  LogDebug("FastCalorimetry") << " EMShowerSimulation " <<myTrack << std::endl;
305  }
306 
307  // std::cout << " Simulating " << myTrack << std::endl;
308 
309  // The Particle at ECAL entrance
310  // std::cout << " Before ecalEntrance " << std::endl;
311  myPart = myTrack.ecalEntrance();
312 
313  // protection against infinite loop.
314  if ( myTrack.type() == 22 && myPart.e()<0.055) return;
315 
316 
317  // Barrel or Endcap ?
318  int onEcal = myTrack.onEcal();
319  int onHcal = myTrack.onHcal();
320  int onLayer1 = myTrack.onLayer1();
321  int onLayer2 = myTrack.onLayer2();
322 
323  // The entrance in ECAL
324  XYZPoint ecalentrance = myPart.vertex().Vect();
325 
326  // std::cout << " Ecal entrance " << ecalentrance << std::endl;
327 
328  // The preshower
329  PreshowerHitMaker * myPreshower = NULL ;
330  if(simulatePreshower_ && (onLayer1 || onLayer2))
331  {
332  XYZPoint layer1entrance,layer2entrance;
333  XYZVector dir1,dir2;
334  if(onLayer1)
335  {
336  layer1entrance = XYZPoint(myTrack.layer1Entrance().vertex().Vect());
337  dir1 = XYZVector(myTrack.layer1Entrance().Vect().Unit());
338  }
339  if(onLayer2)
340  {
341  layer2entrance = XYZPoint(myTrack.layer2Entrance().vertex().Vect());
342  dir2 = XYZVector(myTrack.layer2Entrance().Vect().Unit());
343  }
344  // std::cout << " Layer1entrance " << layer1entrance << std::endl;
345  // std::cout << " Layer2entrance " << layer2entrance << std::endl;
346  myPreshower = new PreshowerHitMaker(myCalorimeter_,
347  layer1entrance,
348  dir1,
349  layer2entrance,
350  dir2,
352  myPreshower->setMipEnergy(mipValues_[0],mipValues_[1]);
353  }
354 
355  // The ECAL Properties
357  showerparam(myCalorimeter_->ecalProperties(onEcal),
358  myCalorimeter_->hcalProperties(onHcal),
359  myCalorimeter_->layer1Properties(onLayer1),
360  myCalorimeter_->layer2Properties(onLayer2),
363  RCFactor_,
364  RTFactor_);
365 
366  // Photons : create an e+e- pair
367  if ( myTrack.type() == 22 ) {
368 
369  // Depth for the first e+e- pair creation (in X0)
370  X0depth = -log(random->flatShoot()) * (9./7.);
371 
372  // Initialization
373  double eMass = 0.000510998902;
374  double xe=0;
375  double xm=eMass/myPart.e();
376  double weight = 0.;
377 
378  // Generate electron energy between emass and eGamma-emass
379  do {
380  xe = random->flatShoot()*(1.-2.*xm) + xm;
381  weight = 1. - 4./3.*xe*(1.-xe);
382  } while ( weight < random->flatShoot() );
383 
384  // Protection agains infinite loop in Famos Shower
385  if ( myPart.e()*xe < 0.055 || myPart.e()*(1.-xe) < 0.055 ) {
386 
387  if ( myPart.e() > 0.055 ) thePart.push_back(&myPart);
388 
389  } else {
390 
391  myElec = (myPart) * xe;
392  myPosi = (myPart) * (1.-xe);
395  thePart.push_back(&myElec);
396  thePart.push_back(&myPosi);
397  }
398  // Electrons
399  } else {
400 
401  X0depth = 0.;
402  if ( myPart.e() > 0.055 ) thePart.push_back(&myPart);
403 
404  }
405 
406  // After the different protections, this shouldn't happen.
407  if(thePart.size()==0)
408  {
409  if(myPreshower==NULL) return;
410  delete myPreshower;
411  return;
412  }
413 
414  // find the most energetic particle
415  double maxEnergy=-1.;
416  for(unsigned ip=0;ip < thePart.size();++ip)
417  if(thePart[ip]->e() > maxEnergy) maxEnergy = thePart[ip]->e();
418 
419  // Initialize the Grid in ECAL
420  int size = gridSize_;
421  if(maxEnergy>100) size=11;
422 // if ( maxEnergy < threshold5x5 ) size = 5;
423 // if ( maxEnergy < threshold3x3 ) size = 3;
424 
425 
426  EMShower theShower(random,aGammaGenerator,&showerparam,&thePart, dbe, NULL, NULL, bFixedLength_);
427 
428 
429  double maxShower = theShower.getMaximumOfShower();
430  if (maxShower > 20.) maxShower = 2.; // simple pivot-searching protection
431 
432  double depth((X0depth + maxShower) *
434  XYZPoint meanShower = ecalentrance + myPart.Vect().Unit()*depth;
435 
436  // if(onEcal!=1) return ;
437 
438  // The closest crystal
439  DetId pivot(myCalorimeter_->getClosestCell(meanShower, true, onEcal==1));
440 
441  if(pivot.subdetId() == 0) { // further protection against avbsence of pivot
442  edm::LogWarning("CalorimetryManager") << "Pivot for egamma e = " << myTrack.hcalEntrance().e() << " is not found at depth " << depth << " and meanShower coordinates = " << meanShower << std::endl;
443  if(myPreshower) delete myPreshower;
444  return;
445  }
446 
447  EcalHitMaker myGrid(myCalorimeter_,ecalentrance,pivot,onEcal,size,0,random);
448  // ^^^^
449  // for EM showers
452 
453  //maximumdepth dependence of the radiusfactorbehindpreshower
454  //First tuning: Shilpi Jain (Mar-Apr 2010); changed after tuning - Feb-July - Shilpi Jain
455  /* **************
456  myGrid.setRadiusFactor(radiusFactor_);
457  if(onLayer1 || onLayer2)
458  {
459  float b = radiusPreshowerCorrections_[0];
460  float a = radiusFactor_*( 1.+radiusPreshowerCorrections_[1]*radiusPreshowerCorrections_[0] );
461  float maxdepth = X0depth+theShower.getMaximumOfShower();
462  float newRadiusFactor = radiusFactor_;
463  if(myPart.e()<=250.)
464  {
465  newRadiusFactor = a/(1.+b*maxdepth);
466  }
467  myGrid.setRadiusFactor(newRadiusFactor);
468  }
469  else // otherwise use the normal radius factor
470  {
471  myGrid.setRadiusFactor(radiusFactor_);
472  }
473  ************** */
474  if(myTrack.onEcal() == 2) // if on EE
475  {
476  if( (onLayer1 || onLayer2) && myPart.e()<=250.)
477  {
478  double maxdepth = X0depth+theShower.getMaximumOfShower();
479  double newRadiusFactor = radiusFactorEE_ * aTerm/(1.+bTerm*maxdepth);
480  myGrid.setRadiusFactor(newRadiusFactor);
481  }
482  else // otherwise use the normal radius factor
483  {
485  }
486  }//if(myTrack.onEcal() == 2)
487  else // else if on EB
488  {
490  }
491  //(end of) changed after tuning - Feb-July - Shilpi Jain
492 
494 
495  // The shower simulation
496  myGrid.setTrackParameters(myPart.Vect().Unit(),X0depth,myTrack);
497 
498 // std::cout << " PS ECAL GAP HCAL X0 " << myGrid.ps1TotalX0()+myGrid.ps2TotalX0() << " " << myGrid.ecalTotalX0();
499 // std::cout << " " << myGrid.ecalHcalGapTotalX0() << " " << myGrid.hcalTotalX0() << std::endl;
500 // std::cout << " PS ECAL GAP HCAL L0 " << myGrid.ps1TotalL0()+myGrid.ps2TotalL0() << " " << myGrid.ecalTotalL0();
501 // std::cout << " " << myGrid.ecalHcalGapTotalL0() << " " << myGrid.hcalTotalL0() << std::endl;
502 // std::cout << "ECAL-HCAL " << myTrack.momentum().eta() << " " << myGrid.ecalHcalGapTotalL0() << std::endl;
503 //
504 // std::cout << " Grid created " << std::endl;
505  if(myPreshower) theShower.setPreshower(myPreshower);
506 
507  HcalHitMaker myHcalHitMaker(myGrid,(unsigned)0);
508 
509  theShower.setGrid(&myGrid);
510  theShower.setHcal(&myHcalHitMaker);
511  theShower.compute();
512  //myHistos->fill("h502", myPart->eta(),myGrid.totalX0());
513 
514  // Save the hits !
515  std::map<uint32_t,float>::const_iterator mapitr;
516  std::map<uint32_t,float>::const_iterator endmapitr=myGrid.getHits().end();
517  for(mapitr=myGrid.getHits().begin();mapitr!=endmapitr;++mapitr)
518  {
519  if(onEcal==1)
520  {
521  updateMap(EBDetId(mapitr->first).hashedIndex(), mapitr->second,myTrack.id(),EBMapping_,firedCellsEB_);
522  }
523 
524  else if(onEcal==2)
525  updateMap(EEDetId(mapitr->first).hashedIndex(), mapitr->second,myTrack.id(),EEMapping_,firedCellsEE_);
526  // std::cout << " Adding " <<mapitr->first << " " << mapitr->second <<std::endl;
527  }
528 
529  // Now fill the HCAL hits
530  endmapitr=myHcalHitMaker.getHits().end();
531  for(mapitr=myHcalHitMaker.getHits().begin();mapitr!=endmapitr;++mapitr)
532  {
533  updateMap(HcalDetId(mapitr->first).hashed_index(),mapitr->second,myTrack.id(),HMapping_,firedCellsHCAL_);
534  // std::cout << " Adding " <<mapitr->first << " " << mapitr->second <<std::endl;
535  }
536 
537  // delete the preshower
538  if(myPreshower!=0)
539  {
540  endmapitr=myPreshower->getHits().end();
541  for(mapitr=myPreshower->getHits().begin();mapitr!=endmapitr;++mapitr)
542  {
543  updateMap(mapitr->first,mapitr->second,myTrack.id(),ESMapping_);
544  // std::cout << " Adding " <<mapitr->first << " " << mapitr->second <<std::endl;
545  }
546  delete myPreshower;
547  // std::cout << " Deleting myPreshower " << std::endl;
548  }
549 
550 }
551 
552 
553 
554 // Simulation of electromagnetic showers in VFCAL
556  if(debug_) {
557  XYZTLorentzVector moment = track.momentum();
558  std::cout << "FASTEnergyReconstructor::reconstructECAL - " << std::endl
559  << " eta " << moment.eta() << std::endl
560  << " phi " << moment.phi() << std::endl
561  << " et " << moment.Et() << std::endl;
562  }
563 
564  int hit;
565 
566  bool central=track.onEcal()==1;
567 
568  //Reconstruct only electrons and photons.
569 
570  //deal with different conventions
571  // ParticlePropagator 1 <-> Barrel
572  // 2 <-> EC
573  // whereas for Artur(this code):
574  // 0 <-> Barrel
575  // 1 <-> EC
576  // 2 <-> VF
577  XYZTLorentzVector trackPosition;
578  if( track.onEcal() ) {
579  hit=track.onEcal()-1;
580  trackPosition=track.ecalEntrance().vertex();
581  } else {
582  hit=2;
583  trackPosition=track.vfcalEntrance().vertex();
584  }
585 
586  double pathEta = trackPosition.eta();
587  double pathPhi = trackPosition.phi();
588  double EGen = track.ecalEntrance().e();
589 
590 
591  double e=0.;
592  double sigma=0.;
593  // if full simulation and in HF, but without showering anyway...
594  if(hit == 2 && optionHDSim_ == 2 ) {
595  std::pair<double,double> response =
596  myHDResponse_->responseHCAL(0, EGen, pathEta, 0); // last par.= 0 = e/gamma
597  e = response.first;
598  sigma = response.second;
599  }
600 
601  double emeas = 0.;
602 
603  if(sigma>0.)
604  emeas = random->gaussShoot(e,sigma);
605 
606 
607  if(debug_)
608  std::cout << "FASTEnergyReconstructor::reconstructECAL : "
609  << " on-calo eta, phi = " << pathEta << " " << pathPhi << std::endl
610  << " Egen = " << EGen << std::endl
611  << " Eres = " << e << std::endl
612  << " sigma = " << sigma << std::endl
613  << " Emeas = " << emeas << std::endl;
614 
615 
616  if(debug_)
617  std::cout << "FASTEnergyReconstructor::reconstructECAL : "
618  << " Track position - " << trackPosition.Vect()
619  << " bool central - " << central
620  << " hit - " << hit << std::endl;
621 
622  DetId detid;
623  if( hit==2 )
624  detid = myCalorimeter_->getClosestCell(trackPosition.Vect(),false,central);
625  // Check that the detid is HCAL forward
626  HcalDetId hdetid(detid);
627  if(!hdetid.subdetId()!=HcalForward) return;
628 
629  if(debug_)
630  std::cout << "FASTEnergyReconstructor::reconstructECAL : "
631  << " CellID - " << detid.rawId() << std::endl;
632 
633  if( hit != 2 || emeas > 0.)
634  if(!detid.null())
635  {
636  updateMap(hdetid.hashed_index(),emeas,track.id(),HMapping_,firedCellsHCAL_);
637  }
638 
639 }
640 
641 
643 {
644  int hit;
645  int pid = abs(myTrack.type());
646  if (debug_) {
647  LogDebug("FastCalorimetry") << " reconstructHCAL " << myTrack << std::endl;
648  }
649 
650  // FSimTrack myTrack = mySimEvent.track(fsimi);
651 
652  // int pid=abs(myTrack.type());
653  // std::cout << "reconstructHCAL " << std::endl;
654 
655  XYZTLorentzVector trackPosition;
656  if (myTrack.onHcal()) {
657  trackPosition=myTrack.hcalEntrance().vertex();
658  hit = myTrack.onHcal()-1;
659  } else {
660  trackPosition=myTrack.vfcalEntrance().vertex();
661  hit = 2;
662  }
663 
664  double pathEta = trackPosition.eta();
665  double pathPhi = trackPosition.phi();
666  // double pathTheta = trackPosition.theta();
667 
668  double EGen = myTrack.hcalEntrance().e();
669  double e = 0.;
670  double sigma = 0.;
671  double emeas = 0.;
672 
673  if(pid == 13) {
674  // std::cout << " We should not be here " << std::endl;
675  std::pair<double,double> response =
676  myHDResponse_->responseHCAL(0, EGen, pathEta, 2); // 2=muon
677  emeas = response.first;
678  if(debug_)
679  LogDebug("FastCalorimetry") << "CalorimetryManager::reconstructHCAL - MUON !!!" << std::endl;
680  }
681  else if( pid == 22 || pid == 11)
682  {
683 
684  std::pair<double,double> response =
685  myHDResponse_->responseHCAL(0, EGen, pathEta, 0); // last par. = 0 = e/gamma
686  e = response.first; //
687  sigma = response.second; //
688  emeas = random->gaussShoot(e,sigma); //
689 
690  // cout << "CalorimetryManager::reconstructHCAL - e/gamma !!!" << std::endl;
691  if(debug_)
692  LogDebug("FastCalorimetry") << "CalorimetryManager::reconstructHCAL - e/gamma !!!" << std::endl;
693  }
694  else {
695  e = myHDResponse_->getHCALEnergyResponse(EGen,hit);
696  sigma = myHDResponse_->getHCALEnergyResolution(EGen, hit);
697 
698  emeas = random->gaussShoot(e,sigma);
699  }
700 
701 
702  if(debug_)
703  LogDebug("FastCalorimetry") << "CalorimetryManager::reconstructHCAL - on-calo "
704  << " eta = " << pathEta
705  << " phi = " << pathPhi
706  << " Egen = " << EGen
707  << " Eres = " << e
708  << " sigma = " << sigma
709  << " Emeas = " << emeas << std::endl;
710 
711  if(emeas > 0.) {
712  DetId cell = myCalorimeter_->getClosestCell(trackPosition.Vect(),false,false);
713  updateMap(HcalDetId(cell).hashed_index(), emeas, myTrack.id(),HMapping_,firedCellsHCAL_);
714  }
715 }
716 
718 {
719  // TimeMe t(" FASTEnergyReconstructor::HDShower");
720  XYZTLorentzVector moment = myTrack.momentum();
721 
722  if(debug_)
723  LogDebug("FastCalorimetry")
724  << "CalorimetryManager::HDShowerSimulation - track param."
725  << std::endl
726  << " eta = " << moment.eta() << std::endl
727  << " phi = " << moment.phi() << std::endl
728  << " et = " << moment.Et() << std::endl
729  << " e = " << myTrack.hcalEntrance().e() << std::endl;
730 
731  if (debug_) {
732  LogDebug("FastCalorimetry") << " HDShowerSimulation " << myTrack << std::endl;
733  }
734 
735 
736  int hit;
737  // int pid = abs(myTrack.type());
738 
739  XYZTLorentzVector trackPosition;
740  if ( myTrack.onEcal() ) {
741  trackPosition=myTrack.ecalEntrance().vertex();
742  hit = myTrack.onEcal()-1; //
743  myPart = myTrack.ecalEntrance();
744  } else if ( myTrack.onVFcal()) {
745  trackPosition=myTrack.vfcalEntrance().vertex();
746  hit = 2;
747  myPart = myTrack.vfcalEntrance();
748  }
749  else
750  {
751  LogDebug("FastCalorimetry") << " The particle is not in the acceptance " << std::endl;
752  return;
753  }
754 
755  // int onHCAL = hit + 1; - specially for myCalorimeter->hcalProperties(onHCAL)
756  // (below) to get VFcal properties ...
757  int onHCAL = hit + 1;
758  int onECAL = myTrack.onEcal();
759 
760  double pathEta = trackPosition.eta();
761  double pathPhi = trackPosition.phi();
762  // double pathTheta = trackPosition.theta();
763 
764  double eint = moment.e();
765  double eGen = myTrack.hcalEntrance().e();
766  double e = 0.;
767  double sigma = 0.;
768 
769  double emeas = 0.;
770 
771  //===========================================================================
772  if(eGen > 0.) {
773 
774  // ECAL and HCAL properties to get
776  theHDShowerparam(myCalorimeter_->ecalProperties(onECAL),
779 
780  //Making ECAL Grid (and segments calculation)
781  XYZPoint caloentrance;
782  XYZVector direction;
783  if(myTrack.onEcal())
784  {
785  caloentrance = myTrack.ecalEntrance().vertex().Vect();
786  direction = myTrack.ecalEntrance().Vect().Unit();
787  }
788  else if(myTrack.onHcal())
789  {
790  caloentrance = myTrack.hcalEntrance().vertex().Vect();
791  direction = myTrack.hcalEntrance().Vect().Unit();
792  }
793  else
794  {
795  caloentrance = myTrack.vfcalEntrance().vertex().Vect();
796  direction = myTrack.vfcalEntrance().Vect().Unit();
797  }
798 
799  if(debug_)
800  LogDebug("FastCalorimetry")
801  << "CalorimetryManager::HDShowerSimulation - on-calo 1 "
802  << std::endl
803  << " onEcal = " << myTrack.onEcal() << std::endl
804  << " onHcal = " << myTrack.onHcal() << std::endl
805  << " onVFcal = " << myTrack.onVFcal() << std::endl
806  << " position = " << caloentrance << std::endl;
807 
808 
809  DetId pivot;
810  if(myTrack.onEcal())
811  {
812  pivot=myCalorimeter_->getClosestCell(caloentrance,
813  true, myTrack.onEcal()==1);
814  }
815  else if(myTrack.onHcal())
816  {
817  // std::cout << " CalorimetryManager onHcal " << myTrack.onHcal() << " caloentrance" << caloentrance << std::endl;
818  pivot=myCalorimeter_->getClosestCell(caloentrance,
819  false, false);
820  }
821 
822  EcalHitMaker myGrid(myCalorimeter_,caloentrance,pivot,
823  pivot.null()? 0 : myTrack.onEcal(),hdGridSize_,1,
824  random);
825  // 1=HAD shower
826 
827  myGrid.setTrackParameters(direction,0,myTrack);
828  // Build the FAMOS HCAL
829  HcalHitMaker myHcalHitMaker(myGrid,(unsigned)1);
830 
831  // Shower simulation
832  bool status = false;
833  int mip = 2;
834  // Use HFShower for HF
835  if ( !myTrack.onEcal() && !myTrack.onHcal() ) {
836  // std::cout << "CalorimetryManager::HDShowerSimulation(): track entrance = "
837  // << myTrack.vfcalEntrance().vertex().X() << " "
838  // << myTrack.vfcalEntrance().vertex().Y() << " "
839  // << myTrack.vfcalEntrance().vertex().Z() << " "
840  // << " , Energy (Gen/Scale) = " << eGen << " " << e << std::endl;
841 
842  // Warning : We give here the particle energy with the response
843  // but without the resolution/gaussian smearing
844  // For HF, the resolution is due to the PE statistic
845 
846  HFShower theShower(random,
847  &theHDShowerparam,
848  &myGrid,
849  &myHcalHitMaker,
850  onECAL,
851  eGen);
852  // eGen);
853  // e); // PV Warning : temporarly set the energy to the generated E
854 
855  status = theShower.compute();
856  } else {
857  if(hdSimMethod_ == 0) {
858  HDShower theShower(random,
859  &theHDShowerparam,
860  &myGrid,
861  &myHcalHitMaker,
862  onECAL,
863  eGen);
864  status = theShower.compute();
865  mip = theShower.getmip();
866  }
867  else if (hdSimMethod_ == 1) {
868  HDRShower theShower(random,
869  &theHDShowerparam,
870  &myGrid,
871  &myHcalHitMaker,
872  onECAL,
873  eGen);
874  status = theShower.computeShower();
875  mip = 2;
876  }
877  else if (hdSimMethod_ == 2 ) {
878  // std::cout << "Using GflashHadronShowerProfile hdSimMethod_ == 2" << std::endl;
879 
880  //dynamically loading a corresponding profile by the particle type
881  int particleType = myTrack.type();
883  if(particleType == -2212) theProfile = theAntiProtonProfile;
884  else if(particleType == 2212) theProfile = theProtonProfile;
885 
886  //input variables for GflashHadronShowerProfile
887  int showerType = 99 + myTrack.onEcal();
888  double globalTime = 150.0; // a temporary reference hit time in nanosecond
889  float charge = (float)(myTrack.charge());
890  Gflash3Vector gfpos(trackPosition.X(),trackPosition.Y(),trackPosition.Z());
891  Gflash3Vector gfmom(moment.X(),moment.Y(),moment.Z());
892 
893  theProfile->initialize(showerType,eGen,globalTime,charge,gfpos,gfmom);
896 
897  //make hits
898  std::vector<GflashHit>& gflashHitList = theProfile->getGflashHitList();
899  std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
900  std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
901 
903 
904  for( ; spotIter != spotIterEnd; spotIter++){
905 
906  double pathLength = theProfile->getGflashShowino()->getPathLengthAtShower()
907  + (30*100/eGen)*(spotIter->getTime() - globalTime);
908 
909  double currentDepth = std::max(0.0,pathLength - theProfile->getGflashShowino()->getPathLengthOnEcal());
910 
911  //find the the showino position at the currentDepth
912  GflashTrajectoryPoint trajectoryPoint;
913  theProfile->getGflashShowino()->getHelix()->getGflashTrajectoryPoint(trajectoryPoint,pathLength);
914  Gflash3Vector positionAtCurrentDepth = trajectoryPoint.getPosition();
915  //find radial distrance
916  Gflash3Vector lateralDisplacement = positionAtCurrentDepth - spotIter->getPosition()/CLHEP::cm;
917  double rShower = lateralDisplacement.r();
918  double azimuthalAngle = lateralDisplacement.phi();
919 
920  whichCalor = Gflash::getCalorimeterNumber(positionAtCurrentDepth);
921 
922  if(whichCalor==Gflash::kESPM || whichCalor==Gflash::kENCA) {
923  bool statusPad = myGrid.getPads(currentDepth,true);
924  if(!statusPad) continue;
925  myGrid.setSpotEnergy(1.2*spotIter->getEnergy()/CLHEP::GeV);
926  myGrid.addHit(rShower/Gflash::intLength[Gflash::kESPM],azimuthalAngle,0);
927  }
928  else if(whichCalor==Gflash::kHB || whichCalor==Gflash::kHE) {
929  bool setHDdepth = myHcalHitMaker.setDepth(currentDepth,true);
930  if(!setHDdepth) continue;
931  myHcalHitMaker.setSpotEnergy(1.4*spotIter->getEnergy()/CLHEP::GeV);
932  myHcalHitMaker.addHit(rShower/Gflash::intLength[Gflash::kHB],azimuthalAngle,0);
933  }
934  }
935  status = true;
936  }
937  else {
938  edm::LogInfo("FastSimulationCalorimetry") << " SimMethod " << hdSimMethod_ <<" is NOT available ";
939  }
940  }
941 
942 
943  if(status) {
944 
945  // Here to switch between simple formulae and parameterized response
946  if(optionHDSim_ == 1) {
947  e = myHDResponse_->getHCALEnergyResponse (eGen, hit);
948  sigma = myHDResponse_->getHCALEnergyResolution(eGen, hit);
949  }
950  else { // optionHDsim == 2
951  std::pair<double,double> response =
952  myHDResponse_->responseHCAL(mip, eGen, pathEta, 1); // 1=hadron
953  e = response.first;
954  sigma = response.second;
955  }
956 
957  emeas = random->gaussShoot(e,sigma);
958  double correction = emeas / eGen;
959 
960  // RespCorrP factors (ECAL and HCAL separately) calculation
961  respCorr(eint);
962 
963  if(debug_)
964  LogDebug("FastCalorimetry")
965  << "CalorimetryManager::HDShowerSimulation - on-calo 2" << std::endl
966  << " eta = " << pathEta << std::endl
967  << " phi = " << pathPhi << std::endl
968  << " Egen = " << eGen << std::endl
969  << " Eres = " << e << std::endl
970  << " sigma = " << sigma << std::endl
971  << " Emeas = " << emeas << std::endl
972  << " corr = " << correction << std::endl
973  << " mip = " << mip << std::endl;
974 
975 
976  // was map<unsigned,double> but CaloHitMaker uses float
977  std::map<unsigned,float>::const_iterator mapitr;
978  std::map<unsigned,float>::const_iterator endmapitr;
979  if(myTrack.onEcal() > 0) {
980  // Save ECAL hits
981  endmapitr=myGrid.getHits().end();
982  for(mapitr=myGrid.getHits().begin(); mapitr!=endmapitr; ++mapitr) {
983  double energy = mapitr->second;
984  energy *= correction; // RESCALING
985  energy *= ecorr;
986 
987  if(energy > 0.000001) {
988  if(onECAL==1)
989  updateMap(EBDetId(mapitr->first).hashedIndex(),energy,myTrack.id(),EBMapping_,firedCellsEB_);
990 
991  else if(onECAL==2)
992  updateMap(EEDetId(mapitr->first).hashedIndex(),energy,myTrack.id(),EEMapping_,firedCellsEE_);
993 
994  if(debug_)
995  LogDebug("FastCalorimetry") << " ECAL cell " << mapitr->first << " added, E = "
996  << energy << std::endl;
997  }
998  }
999  }
1000 
1001  // Save HCAL hits
1002  endmapitr=myHcalHitMaker.getHits().end();
1003  for(mapitr=myHcalHitMaker.getHits().begin(); mapitr!=endmapitr; ++mapitr) {
1004  double energy = mapitr->second;
1005  energy *= correction; // RESCALING
1006  energy *= hcorr;
1007 
1008  updateMap(HcalDetId(mapitr->first).hashed_index(),energy,myTrack.id(),HMapping_,firedCellsHCAL_);
1009  if(debug_)
1010  LogDebug("FastCalorimetry") << " HCAL cell "
1011  << mapitr->first << " added E = "
1012  << mapitr->second << std::endl;
1013  }
1014  }
1015  else { // shower simulation failed
1016 // std::cout << " Shower simulation failed " << trackPosition.Vect() << std::endl;
1017 // std::cout << " The FSimTrack " << myTrack << std::endl;
1018 // std::cout << " HF entrance on VFcal" << myTrack.onVFcal() << std::endl;
1019 // std::cout << " trackPosition.eta() " << trackPosition.eta() << std::endl;
1020  if(myTrack.onHcal() || myTrack.onVFcal())
1021  {
1022  DetId cell = myCalorimeter_->getClosestCell(trackPosition.Vect(),false,false);
1023  updateMap(HcalDetId(cell).hashed_index(),emeas,myTrack.id(),HMapping_,firedCellsHCAL_);
1024  if(debug_)
1025  LogDebug("FastCalorimetry") << " HCAL simple cell "
1026  << cell.rawId() << " added E = "
1027  << emeas << std::endl;
1028  }
1029  }
1030 
1031  } // e > 0. ...
1032 
1033  if(debug_)
1034  LogDebug("FastCalorimetry") << std::endl << " FASTEnergyReconstructor::HDShowerSimulation finished "
1035  << std::endl;
1036 }
1037 
1038 
1040 {
1041  // TimeMe t(" FASTEnergyReconstructor::HDShower");
1042  XYZTLorentzVector moment = myTrack.momentum();
1043 
1044  // Backward compatibility behaviour
1045  if(!theMuonHcalEffects)
1046  {
1047  if(myTrack.onHcal() || myTrack.onVFcal() )
1048  reconstructHCAL(myTrack);
1049 
1050  return;
1051  }
1052 
1053  if(debug_)
1054  LogDebug("FastCalorimetry") << "CalorimetryManager::MuonMipSimulation - track param."
1055  << std::endl
1056  << " eta = " << moment.eta() << std::endl
1057  << " phi = " << moment.phi() << std::endl
1058  << " et = " << moment.Et() << std::endl;
1059 
1060  // int hit;
1061  // int pid = abs(myTrack.type());
1062 
1063  XYZTLorentzVector trackPosition;
1064  if ( myTrack.onEcal() ) {
1065  trackPosition=myTrack.ecalEntrance().vertex();
1066  // hit = myTrack.onEcal()-1; //
1067  myPart = myTrack.ecalEntrance();
1068  } else if ( myTrack.onVFcal()) {
1069  trackPosition=myTrack.vfcalEntrance().vertex();
1070  // hit = 2;
1071  myPart = myTrack.vfcalEntrance();
1072  }
1073  else
1074  {
1075  LogDebug("FastCalorimetry") << " The particle is not in the acceptance " << std::endl;
1076  return;
1077  }
1078 
1079  // int onHCAL = hit + 1; - specially for myCalorimeter->hcalProperties(onHCAL)
1080  // (below) to get VFcal properties ...
1081  // not needed ?
1082  // int onHCAL = hit + 1;
1083  int onECAL = myTrack.onEcal();
1084 
1085  // double pathEta = trackPosition.eta();
1086  // double pathPhi = trackPosition.phi();
1087  // double pathTheta = trackPosition.theta();
1088 
1089  //===========================================================================
1090 
1091  // ECAL and HCAL properties to get
1092 
1093  //Making ECAL Grid (and segments calculation)
1094  XYZPoint caloentrance;
1095  XYZVector direction;
1096  if(myTrack.onEcal())
1097  {
1098  caloentrance = myTrack.ecalEntrance().vertex().Vect();
1099  direction = myTrack.ecalEntrance().Vect().Unit();
1100  }
1101  else if(myTrack.onHcal())
1102  {
1103  caloentrance = myTrack.hcalEntrance().vertex().Vect();
1104  direction = myTrack.hcalEntrance().Vect().Unit();
1105  }
1106  else
1107  {
1108  caloentrance = myTrack.vfcalEntrance().vertex().Vect();
1109  direction = myTrack.vfcalEntrance().Vect().Unit();
1110  }
1111 
1112  DetId pivot;
1113  if(myTrack.onEcal())
1114  {
1115  pivot=myCalorimeter_->getClosestCell(caloentrance,
1116  true, myTrack.onEcal()==1);
1117  }
1118  else if(myTrack.onHcal())
1119  {
1120  // std::cout << " CalorimetryManager onHcal " << myTrack.onHcal() << " caloentrance" << caloentrance << std::endl;
1121  pivot=myCalorimeter_->getClosestCell(caloentrance,
1122  false, false);
1123  }
1124 
1125  EcalHitMaker myGrid(myCalorimeter_,caloentrance,pivot,
1126  pivot.null()? 0 : myTrack.onEcal(),hdGridSize_,0,
1127  random);
1128  // 0 =EM shower -> Unit = X0
1129 
1130  myGrid.setTrackParameters(direction,0,myTrack);
1131 
1132  // Now get the path in the Preshower, ECAL and HCAL along a straight line extrapolation
1133  // but only those in the ECAL are used
1134 
1135  const std::vector<CaloSegment>& segments=myGrid.getSegments();
1136  unsigned nsegments=segments.size();
1137 
1138  int ifirstHcal=-1;
1139  int ilastEcal=-1;
1140 
1141  EnergyLossSimulator* energyLossECAL = 0;
1143  // // Muon brem in ECAL
1144  // MuonBremsstrahlungSimulator* muonBremECAL = 0;
1145  // if (theMuonEcalEffects) muonBremECAL = theMuonEcalEffects->muonBremsstrahlungSimulator();
1146 
1147  for(unsigned iseg=0;iseg<nsegments&&ifirstHcal<0;++iseg)
1148  {
1149 
1150  // in the ECAL, there are two types of segments: PbWO4 and GAP
1151  float segmentSizeinX0=segments[iseg].X0length();
1152 
1153  // Martijn - insert your computations here
1154  float energy=0.0;
1155  if (segmentSizeinX0>0.001 && segments[iseg].material()==CaloSegment::PbWO4 ) {
1156  // The energy loss simulator
1157  float charge = (float)(myTrack.charge());
1158  ParticlePropagator theMuon(moment,trackPosition,charge,0);
1159  theMuon.setID(-(int)charge*13);
1160  if ( energyLossECAL ) {
1161  energyLossECAL->updateState(theMuon, segmentSizeinX0);
1162  energy = energyLossECAL->deltaMom().E();
1163  moment -= energyLossECAL->deltaMom();
1164  }
1165  }
1166  // that's all for ECAL, Florian
1167  // Save the hit only if it is a crystal
1168  if(segments[iseg].material()==CaloSegment::PbWO4)
1169  {
1170  myGrid.getPads(segments[iseg].sX0Entrance()+segmentSizeinX0*0.5);
1171  myGrid.setSpotEnergy(energy);
1172  myGrid.addHit(0.,0.);
1173  ilastEcal=iseg;
1174  }
1175  // Check for end of loop:
1176  if(segments[iseg].material()==CaloSegment::HCAL)
1177  {
1178  ifirstHcal=iseg;
1179  }
1180  }
1181 
1182 
1183  // Build the FAMOS HCAL
1184  HcalHitMaker myHcalHitMaker(myGrid,(unsigned)2);
1185  // float mipenergy=0.1;
1186  // Create the helix with the stepping helix propagator
1187  // to add a hit, just do
1188  // myHcalHitMaker.setSpotEnergy(mipenergy);
1189  // math::XYZVector hcalEntrance;
1190  // if(ifirstHcal>=0) hcalEntrance=segments[ifirstHcal].entrance();
1191  // myHcalHitMaker.addHit(hcalEntrance);
1195  int ilastHcal=-1;
1196  float mipenergy=0.0;
1197 
1198  EnergyLossSimulator* energyLossHCAL = 0;
1200  // // Muon Brem effect
1201  // MuonBremsstrahlungSimulator* muonBremHCAL = 0;
1202  // if (theMuonHcalEffects) muonBremHCAL = theMuonHcalEffects->muonBremsstrahlungSimulator();
1203 
1204  if(ifirstHcal>0 && energyLossHCAL){
1205  for(unsigned iseg=ifirstHcal;iseg<nsegments;++iseg)
1206  {
1207  float segmentSizeinX0=segments[iseg].X0length();
1208  if(segments[iseg].material()==CaloSegment::HCAL) {
1209  ilastHcal=iseg;
1210  if (segmentSizeinX0>0.001) {
1211  // The energy loss simulator
1212  float charge = (float)(myTrack.charge());
1213  ParticlePropagator theMuon(moment,trackPosition,charge,0);
1214  theMuon.setID(-(int)charge*13);
1215  energyLossHCAL->updateState(theMuon, segmentSizeinX0);
1216  mipenergy = energyLossHCAL->deltaMom().E();
1217  moment -= energyLossHCAL->deltaMom();
1218  myHcalHitMaker.setSpotEnergy(mipenergy);
1219  myHcalHitMaker.addHit(segments[iseg].entrance());
1220  }
1221  }
1222  }
1223  }
1224 
1229  //
1230 
1231 
1232 
1233  // Copy the muon SimTrack (Only for Energy loss)
1234  FSimTrack muonTrack(myTrack);
1235  if(energyLossHCAL && ilastHcal>=0) {
1236  math::XYZVector hcalExit=segments[ilastHcal].exit();
1237  muonTrack.setTkPosition(hcalExit);
1238  muonTrack.setTkMomentum(moment);
1239  } else if(energyLossECAL && ilastEcal>=0) {
1240  math::XYZVector ecalExit=segments[ilastEcal].exit();
1241  muonTrack.setTkPosition(ecalExit);
1242  muonTrack.setTkMomentum(moment);
1243  } // else just leave tracker surface position and momentum...
1244 
1245  muonSimTracks.push_back(muonTrack);
1246 
1247 
1248  // no need to change below this line
1249  std::map<unsigned,float>::const_iterator mapitr;
1250  std::map<unsigned,float>::const_iterator endmapitr;
1251  if(myTrack.onEcal() > 0) {
1252  // Save ECAL hits
1253  endmapitr=myGrid.getHits().end();
1254  for(mapitr=myGrid.getHits().begin(); mapitr!=endmapitr; ++mapitr) {
1255  double energy = mapitr->second;
1256  if(onECAL==1)
1257  {
1258  updateMap(EBDetId(mapitr->first).hashedIndex(),energy,myTrack.id(),EBMapping_,firedCellsEB_);
1259  }
1260  else if(onECAL==2)
1261  {
1262  updateMap(EEDetId(mapitr->first).hashedIndex(),energy,myTrack.id(),EEMapping_,firedCellsEE_);
1263  }
1264 
1265  if(debug_)
1266  LogDebug("FastCalorimetry") << " ECAL cell " << mapitr->first << " added, E = "
1267  << energy << std::endl;
1268  }
1269  }
1270 
1271  // Save HCAL hits
1272  endmapitr=myHcalHitMaker.getHits().end();
1273  for(mapitr=myHcalHitMaker.getHits().begin(); mapitr!=endmapitr; ++mapitr) {
1274  double energy = mapitr->second;
1275  {
1276  updateMap(HcalDetId(mapitr->first).hashed_index(),energy,myTrack.id(),HMapping_,firedCellsHCAL_);
1277  }
1278  if(debug_)
1279  LogDebug("FastCalorimetry") << " HCAL cell "
1280  << mapitr->first << " added E = "
1281  << mapitr->second << std::endl;
1282  }
1283 
1284  if(debug_)
1285  LogDebug("FastCalorimetry") << std::endl << " FASTEnergyReconstructor::MipShowerSimulation finished "
1286  << std::endl;
1287 }
1288 
1289 
1291 
1292  edm::ParameterSet ECALparameters = fastCalo.getParameter<edm::ParameterSet>("ECAL");
1293 
1294  evtsToDebug_ = fastCalo.getUntrackedParameter<std::vector<unsigned int> >("EvtsToDebug",std::vector<unsigned>());
1295  debug_ = fastCalo.getUntrackedParameter<bool>("Debug");
1296  useDQM_ = fastCalo.getUntrackedParameter<bool>("useDQM");
1297 
1298  bFixedLength_ = ECALparameters.getParameter<bool>("bFixedLength");
1299  // std::cout << "bFixedLength_ = " << bFixedLength_ << std::endl;
1300 
1301  gridSize_ = ECALparameters.getParameter<int>("GridSize");
1302  spotFraction_ = ECALparameters.getParameter<double>("SpotFraction");
1303  pulledPadSurvivalProbability_ = ECALparameters.getParameter<double>("FrontLeakageProbability");
1304  crackPadSurvivalProbability_ = ECALparameters.getParameter<double>("GapLossProbability");
1305  theCoreIntervals_ = ECALparameters.getParameter<std::vector<double> >("CoreIntervals");
1306  theTailIntervals_ = ECALparameters.getParameter<std::vector<double> >("TailIntervals");
1307 
1308  RCFactor_ = ECALparameters.getParameter<double>("RCFactor");
1309  RTFactor_ = ECALparameters.getParameter<double>("RTFactor");
1310  //changed after tuning - Feb-July - Shilpi Jain
1311  // radiusFactor_ = ECALparameters.getParameter<double>("RadiusFactor");
1312  radiusFactorEE_ = ECALparameters.getParameter<double>("RadiusFactorEE");
1313  radiusFactorEB_ = ECALparameters.getParameter<double>("RadiusFactorEB");
1314  //(end of) changed after tuning - Feb-July - Shilpi Jain
1315  radiusPreshowerCorrections_ = ECALparameters.getParameter<std::vector<double> >("RadiusPreshowerCorrections");
1316  aTerm = 1.+radiusPreshowerCorrections_[1]*radiusPreshowerCorrections_[0];
1317  bTerm = radiusPreshowerCorrections_[0];
1318  mipValues_ = ECALparameters.getParameter<std::vector<double> >("MipsinGeV");
1319  simulatePreshower_ = ECALparameters.getParameter<bool>("SimulatePreshower");
1320 
1321  if(gridSize_ <1) gridSize_= 7;
1322  if(pulledPadSurvivalProbability_ <0. || pulledPadSurvivalProbability_>1 ) pulledPadSurvivalProbability_= 1.;
1323  if(crackPadSurvivalProbability_ <0. || crackPadSurvivalProbability_>1 ) crackPadSurvivalProbability_= 0.9;
1324 
1325  LogInfo("FastCalorimetry") << " Fast ECAL simulation parameters " << std::endl;
1326  LogInfo("FastCalorimetry") << " =============================== " << std::endl;
1327  if(simulatePreshower_)
1328  LogInfo("FastCalorimetry") << " The preshower is present " << std::endl;
1329  else
1330  LogInfo("FastCalorimetry") << " The preshower is NOT present " << std::endl;
1331  LogInfo("FastCalorimetry") << " Grid Size : " << gridSize_ << std::endl;
1332  if(spotFraction_>0.)
1333  LogInfo("FastCalorimetry") << " Spot Fraction : " << spotFraction_ << std::endl;
1334  else
1335  {
1336  LogInfo("FastCalorimetry") << " Core of the shower " << std::endl;
1337  for(unsigned ir=0; ir < theCoreIntervals_.size()/2;++ir)
1338  {
1339  LogInfo("FastCalorimetry") << " r < " << theCoreIntervals_[ir*2] << " R_M : " << theCoreIntervals_[ir*2+1] << " ";
1340  }
1341  LogInfo("FastCalorimetry") << std::endl;
1342 
1343  LogInfo("FastCalorimetry") << " Tail of the shower " << std::endl;
1344  for(unsigned ir=0; ir < theTailIntervals_.size()/2;++ir)
1345  {
1346  LogInfo("FastCalorimetry") << " r < " << theTailIntervals_[ir*2] << " R_M : " << theTailIntervals_[ir*2+1] << " ";
1347  }
1348  //changed after tuning - Feb-July - Shilpi Jain
1349  // LogInfo("FastCalorimetry") << "Radius correction factor " << radiusFactor_ << std::endl;
1350  LogInfo("FastCalorimetry") << "Radius correction factors: EB & EE " << radiusFactorEB_ << " : "<< radiusFactorEE_ << std::endl;
1351  //(end of) changed after tuning - Feb-July - Shilpi Jain
1352  LogInfo("FastCalorimetry") << std::endl;
1353  if(mipValues_.size()>2) {
1354  LogInfo("FastCalorimetry") << "Improper number of parameters for the preshower ; using 95keV" << std::endl;
1355  mipValues_.clear();
1356  mipValues_.resize(2,0.000095);
1357  }
1358  }
1359 
1360  LogInfo("FastCalorimetry") << " FrontLeakageProbability : " << pulledPadSurvivalProbability_ << std::endl;
1361  LogInfo("FastCalorimetry") << " GapLossProbability : " << crackPadSurvivalProbability_ << std::endl;
1362 
1363 
1364  // RespCorrP: p (momentum), ECAL and HCAL corrections = f(p)
1365  edm::ParameterSet CalorimeterParam = fastCalo.getParameter<edm::ParameterSet>("CalorimeterProperties");
1366 
1367  rsp = CalorimeterParam.getParameter<std::vector<double> >("RespCorrP");
1368  LogInfo("FastCalorimetry") << " RespCorrP (rsp) size " << rsp.size() << std::endl;
1369 
1370  if( rsp.size()%3 !=0 ) {
1371  LogInfo("FastCalorimetry")
1372  << " RespCorrP size is wrong -> no corrections applied !!!"
1373  << std::endl;
1374 
1375  p_knots.push_back(14000.);
1376  k_e.push_back (1.);
1377  k_h.push_back (1.);
1378  }
1379  else {
1380  for(unsigned i = 0; i < rsp.size(); i += 3) {
1381  LogInfo("FastCalorimetry") << "i = " << i/3 << " p = " << rsp [i]
1382  << " k_e(p) = " << rsp[i+1]
1383  << " k_e(p) = " << rsp[i+2] << std::endl;
1384 
1385  p_knots.push_back(rsp[i]);
1386  k_e.push_back (rsp[i+1]);
1387  k_h.push_back (rsp[i+2]);
1388  }
1389  }
1390 
1391 
1392  //FR
1393  edm::ParameterSet HCALparameters = fastCalo.getParameter<edm::ParameterSet>("HCAL");
1394  optionHDSim_ = HCALparameters.getParameter<int>("SimOption");
1395  hdGridSize_ = HCALparameters.getParameter<int>("GridSize");
1396  hdSimMethod_ = HCALparameters.getParameter<int>("SimMethod");
1397  //RF
1398 
1399  unfoldedMode_ = fastCalo.getUntrackedParameter<bool>("UnfoldedMode",false);
1400 }
1401 
1402 
1403 void CalorimetryManager::updateMap(uint32_t cellid,float energy,int id,std::map<uint32_t,std::vector<std::pair<int,float> > > & mymap)
1404 {
1405  // std::cout << " updateMap " << std::endl;
1406  std::map<unsigned,std::vector<std::pair<int,float> > >::iterator cellitr;
1407  cellitr = mymap.find(cellid);
1408  if(!unfoldedMode_) id=0;
1409  if( cellitr==mymap.end())
1410  {
1411  std::vector<std::pair<int,float> > myElement;
1412  myElement.push_back(std::pair<int,float> (id,energy));
1413  mymap[cellid]=myElement;
1414  }
1415  else
1416  {
1417  if(!unfoldedMode_)
1418  {
1419  cellitr->second[0].second+=energy;
1420  }
1421  else
1422  cellitr->second.push_back(std::pair<int,float>(id,energy));
1423  }
1424 }
1425 
1426 void CalorimetryManager::updateMap(int hi,float energy,int tid,std::vector<std::vector<std::pair<int,float> > > & mymap, std::vector<int>& firedCells)
1427 {
1428  // Standard case first : one entry per cell
1429  if(!unfoldedMode_)
1430  {
1431  // if new entry, update the list
1432  if(mymap[hi].size()==0)
1433  {
1434  firedCells.push_back(hi);
1435  mymap[hi].push_back(std::pair<int,float>(0,energy));
1436  }
1437  else
1438  mymap[hi][0].second+=energy;
1439  }
1440  else
1441  {
1442  // std::cout << "update map " << mymap[hi].size() << " " << hi << std::setw(8) << std::setprecision(6) << energy ;
1443  // std::cout << " " << mymap[hi][0].second << std::endl;
1444  // the minimal size is always 1 ; in this case, no push_back
1445  if(mymap[hi].size()==0)
1446  {
1447  // if(tid==0) std::cout << " Shit ! " << std::endl;
1448  firedCells.push_back(hi);
1449  }
1450 
1451  mymap[hi].push_back(std::pair<int,float>(tid,energy));
1452  }
1453 
1454 }
1455 
1456 
1458 
1459  int sizeP = p_knots.size();
1460 
1461  if(sizeP <= 1) {
1462  ecorr = 1.;
1463  hcorr = 1.;
1464  }
1465  else {
1466  int ip = -1;
1467  for (int i = 0; i < sizeP; i++) {
1468  if (p < p_knots[i]) { ip = i; break;}
1469  }
1470  if (ip == 0) {
1471  ecorr = k_e[0];
1472  hcorr = k_h[0];
1473  }
1474  else {
1475  if(ip == -1) {
1476  ecorr = k_e[sizeP-1];
1477  hcorr = k_h[sizeP-1];
1478  }
1479  else {
1480  double x1 = p_knots[ip-1];
1481  double x2 = p_knots[ip];
1482  double y1 = k_e[ip-1];
1483  double y2 = k_e[ip];
1484 
1485  if(x1 == x2) {
1486  // std::cout << " equal p_knots values!!! " << std::endl;
1487  }
1488 
1489  ecorr = (y1 + (y2 - y1) * (p - x1)/(x2 - x1));
1490 
1491  y1 = k_h[ip-1];
1492  y2 = k_h[ip];
1493  hcorr = (y1 + (y2 - y1) * (p - x1)/(x2 - x1));
1494 
1495  }
1496  }
1497  }
1498 
1499  if(debug_)
1500  LogDebug("FastCalorimetry") << " p, ecorr, hcorr = " << p << " "
1501  << ecorr << " " << hcorr << std::endl;
1502 
1503 }
1504 
1505 
1507 {
1508  unsigned size=firedCellsEB_.size();
1509  // float sum=0.;
1510  for(unsigned ic=0;ic<size;++ic)
1511  {
1512  int hi=firedCellsEB_[ic];
1513  if(!unfoldedMode_)
1514  {
1515  c.push_back(PCaloHit(EBDetId::unhashIndex(hi),EBMapping_[hi][0].second,0.,0));
1516  // std::cout << "Adding " << hi << " " << EBDetId::unhashIndex(hi) << " " ;
1517  // std::cout << EBMapping_[hi][0].second << " " << EBMapping_[hi][0].first << std::endl;
1518  }
1519  else
1520  {
1521  unsigned npart=EBMapping_[hi].size();
1522  for(unsigned ip=0;ip<npart;++ip)
1523  {
1524  c.push_back(PCaloHit(EBDetId::unhashIndex(hi),EBMapping_[hi][ip].second,0.,
1525  EBMapping_[hi][ip].first));
1526 
1527  }
1528  }
1529 
1530  // sum+=cellit->second;
1531  }
1532 
1533 // for(unsigned ic=0;ic<61200;++ic)
1534 // {
1535 // EBDetId myCell(EBDetId::unhashIndex(ic));
1536 // if(!myCell.null())
1537 // {
1538 // float total=0.;
1539 // for(unsigned id=0;id<EBMapping_[ic].size();++id)
1540 // total+=EBMapping_[ic][id].second;
1541 // if(EBMapping_[ic].size()>0)
1542 // std::cout << "Adding " << ic << " " << myCell << " " << std::setprecision(8) <<total << std::endl;
1543 // }
1544 // }
1545 
1546 
1547  // std::cout << " SUM : " << sum << std::endl;
1548  // std::cout << " Added " <<c.size() << " hits " <<std::endl;
1549 }
1550 
1551 
1553 {
1554  unsigned size=firedCellsEE_.size();
1555  // float sum=0.;
1556  for(unsigned ic=0;ic<size;++ic)
1557  {
1558  int hi=firedCellsEE_[ic];
1559  if(!unfoldedMode_)
1560  c.push_back(PCaloHit(EEDetId::unhashIndex(hi),EEMapping_[hi][0].second,0.,0));
1561  else
1562  {
1563  unsigned npart=EEMapping_[hi].size();
1564  for(unsigned ip=0;ip<npart;++ip)
1565  c.push_back(PCaloHit(EEDetId::unhashIndex(hi),EEMapping_[hi][ip].second,0.,
1566  EEMapping_[hi][ip].first));
1567  }
1568 
1569  // sum+=cellit->second;
1570  }
1571  // std::cout << " SUM : " << sum << std::endl;
1572  // std::cout << " Added " <<c.size() << " hits " <<std::endl;
1573 }
1574 
1576 {
1577  unsigned size=firedCellsHCAL_.size();
1578  // float sum=0.;
1579  for(unsigned ic=0;ic<size;++ic)
1580  {
1581  int hi=firedCellsHCAL_[ic];
1582  if(!unfoldedMode_)
1583  c.push_back(PCaloHit(theDetIds_[hi],HMapping_[hi][0].second,0.,0));
1584  else
1585  {
1586  unsigned npart=HMapping_[hi].size();
1587  for(unsigned ip=0;ip<npart;++ip)
1588  c.push_back(PCaloHit(theDetIds_[hi],HMapping_[hi][ip].second,0.,
1589  HMapping_[hi][ip].first));
1590  }
1591 
1592  // sum+=cellit->second;
1593  }
1594  // std::cout << " SUM : " << sum << std::endl;
1595  // std::cout << " Added " <<c.size() << " hits " <<std::endl;
1596 }
1597 
1599 {
1600  std::map<uint32_t,std::vector<std::pair< int,float> > >::const_iterator cellit;
1601  std::map<uint32_t,std::vector<std::pair <int,float> > >::const_iterator preshEnd=ESMapping_.end();
1602 
1603  for(cellit=ESMapping_.begin();cellit!=preshEnd;++cellit)
1604  {
1605  if(!unfoldedMode_)
1606  c.push_back(PCaloHit(cellit->first,cellit->second[0].second,0.,0));
1607  else
1608  {
1609  unsigned npart=cellit->second.size();
1610  for(unsigned ip=0;ip<npart;++ip)
1611  {
1612  c.push_back(PCaloHit(cellit->first,cellit->second[ip].second,0.,cellit->second[ip].first));
1613  }
1614  }
1615  }
1616 }
1617 
1618 
1619 // The main danger in this method is to screw up to relationships between particles
1620 // So, the muon FSimTracks created by FSimEvent.cc are simply to be updated
1622 {
1623  unsigned size=muons.size();
1624  for(unsigned i=0; i<size;++i)
1625  {
1626  int id=muons[i].trackId();
1627  if(abs(muons[i].type())!=13) continue;
1628  // identify the corresponding muon in the local collection
1629 
1630  std::vector<FSimTrack>::const_iterator itcheck=find_if(muonSimTracks.begin(),muonSimTracks.end(),FSimTrackEqual(id));
1631  if(itcheck!=muonSimTracks.end())
1632  {
1633  muons[i].setTkPosition(itcheck->trackerSurfacePosition());
1634  muons[i].setTkMomentum(itcheck->trackerSurfaceMomentum());
1635 // std::cout << " Found the SimTrack " << std::endl;
1636 // std::cout << *itcheck << std::endl;
1637 // std::cout << "SimTrack Id "<< id << " " << muons[i] << " " << std::endl;
1638  }
1639 // else
1640 // {
1641 // std::cout << " Calorimetery Manager : this should really not happen " << std::endl;
1642 // std::cout << " Was looking for " << id << " " << muons[i] << std::endl;
1643 // for(unsigned i=0;i<muonSimTracks.size();++i)
1644 // std::cout << muonSimTracks[i] << std::endl;
1645 // }
1646  }
1647 
1648 }
1649 
#define LogDebug(id)
void setSpotEnergy(double e)
Set the spot energy.
Definition: HcalHitMaker.h:28
double getHCALEnergyResponse(double e, int hit)
type
Definition: HCALResponse.h:22
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< double > rsp
std::vector< double > k_h
bool noEndVertex() const
no end vertex
RawParticle myElec
A few pointers to save time.
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:73
float charge() const
charge
Definition: FSimTrack.h:47
std::vector< PCaloHit > PCaloHitContainer
const ECALProperties * ecalProperties(int onEcal) const
ECAL properties.
Definition: Calorimeter.cc:73
const RawParticle & vfcalEntrance() const
The particle at VFCAL entrance.
Definition: FSimTrack.h:139
int onLayer2() const
Definition: FSimTrack.h:96
GflashPiKShowerProfile * thePiKProfile
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
void updateMap(uint32_t cellid, float energy, int id, std::map< uint32_t, std::vector< std::pair< int, float > > > &mymap)
std::map< uint32_t, std::vector< std::pair< int, float > > > ESMapping_
double radLenIncm() const
Radiation length in cm.
GflashTrajectory * getHelix()
Definition: GflashShowino.h:30
MaterialEffects * theMuonEcalEffects
MaterialEffects * theMuonHcalEffects
const XYZTLorentzVector & momentum() const
Temporary (until move of SimTrack to Mathcore) - No! Actually very useful.
Definition: FSimTrack.h:190
void setCrackPadSurvivalProbability(double val)
Definition: EcalHitMaker.h:134
std::vector< std::vector< std::pair< int, float > > > EBMapping_
response responseHCAL(int mip, double energy, double eta, int partype)
GflashHadronShowerProfile * theProfile
const RawParticle & layer1Entrance() const
The particle at Preshower Layer 1.
Definition: FSimTrack.h:127
bool compute()
Compute the shower longitudinal and lateral development.
Definition: HDShower.cc:471
std::pair< double, double > response
Definition: HCALResponse.h:20
#define abs(x)
Definition: mlp_lapack.h:159
void reconstructECAL(const FSimTrack &track)
void setPreshower(PreshowerHitMaker *const myPresh)
set the preshower address
Definition: EMShower.cc:731
void loadFromPreshower(edm::PCaloHitContainer &c) const
#define NULL
Definition: scimark2.h:8
double npart
Definition: HydjetWrapper.h:45
const CaloSubdetectorGeometry * getHcalGeometry() const
Definition: Calorimeter.h:57
void readParameters(const edm::ParameterSet &fastCalo)
TRandom random
Definition: MVATrainer.cc:138
const PreshowerLayer1Properties * layer1Properties(int onLayer1) const
Preshower Layer1 properties.
Definition: Calorimeter.cc:100
void HDShowerSimulation(const FSimTrack &myTrack)
Hadronic Shower Simulation.
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:115
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
void MuonMipSimulation(const FSimTrack &myTrack)
std::vector< std::vector< std::pair< int, float > > > EEMapping_
std::vector< double > p_knots
double charge(const std::vector< uint8_t > &Ampls)
void compute()
Compute the shower longitudinal and lateral development.
Definition: EMShower.cc:302
std::vector< int > firedCellsEB_
double gaussShoot(double mean=0.0, double sigma=1.0) const
Definition: RandomEngine.h:37
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
dictionary map
Definition: Association.py:205
std::vector< int > firedCellsHCAL_
int onEcal() const
Definition: FSimTrack.h:101
std::vector< FSimTrack > muonSimTracks
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
const RandomEngine * random
U second(std::pair< T, U > const &p)
const LandauFluctuationGenerator * aLandauGenerator
bool compute()
Compute the shower longitudinal and lateral development.
Definition: HFShower.cc:475
void setRadiusFactor(double r)
Definition: EcalHitMaker.h:130
GflashAntiProtonShowerProfile * theAntiProtonProfile
math::XYZVector XYZVector
int getmip()
Definition: HDShower.h:41
GflashProtonShowerProfile * theProtonProfile
const PreshowerLayer2Properties * layer2Properties(int onLayer2) const
Preshower Layer2 properties.
Definition: Calorimeter.cc:108
const T & max(const T &a, const T &b)
double getPathLengthAtShower()
Definition: GflashShowino.h:26
void setTrackParameters(const XYZNormal &normal, double X0depthoffset, const FSimTrack &theTrack)
void loadFromEcalEndcap(edm::PCaloHitContainer &c) const
void setID(const int id)
Definition: RawParticle.cc:101
const XYZTLorentzVector & deltaMom() const
Returns the actual energy lost.
std::vector< DetId > theDetIds_
std::vector< double > radiusPreshowerCorrections_
std::vector< int > firedCellsEE_
const HCALProperties * hcalProperties(int onHcal) const
HCAL properties.
Definition: Calorimeter.cc:84
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
Definition: FSimTrack.h:133
int onVFcal() const
Definition: FSimTrack.h:111
const std::map< uint32_t, float > & getHits()
Definition: HcalHitMaker.h:37
std::vector< double > theTailIntervals_
bool first
Definition: L1TdeRCT.cc:94
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
std::vector< std::vector< std::pair< int, float > > > HMapping_
void loadMuonSimTracks(edm::SimTrackContainer &m) const
unsigned int nTracks() const
Number of tracks.
Definition: FSimEvent.cc:48
HCALResponse * myHDResponse_
CaloGeometryHelper * myCalorimeter_
const std::map< unsigned, float > & getHits()
const double intLength[kNumberCalorimeter]
std::vector< double > theCoreIntervals_
void getGflashTrajectoryPoint(GflashTrajectoryPoint &point, double s) const
edm::EventID id() const
Method to return the EventId.
Definition: FSimEvent.cc:39
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:284
Definition: DetId.h:20
void loadFromHcal(edm::PCaloHitContainer &c) const
void updateState(ParticlePropagator &myTrack, double radlen)
Compute the material effect (calls the sub class)
int hashedIndex() const
Definition: EEDetId.h:177
void EMShowerSimulation(const FSimTrack &myTrack)
GammaFunctionGenerator * aGammaGenerator
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
CLHEP::Hep3Vector Gflash3Vector
Definition: Gflash3Vector.h:6
std::vector< double > mipValues_
static std::vector< std::pair< int, float > > myZero_
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.cc:12
bool null() const
is this a null id ?
Definition: DetId.h:47
CalorimeterNumber getCalorimeterNumber(const Gflash3Vector position)
void setTkPosition(const math::XYZVectorD &pos)
Definition: SimTrack.h:40
double flatShoot(double xmin=0.0, double xmax=1.0) const
Definition: RandomEngine.h:30
double getPathLengthOnEcal()
Definition: GflashShowino.h:25
math::XYZVector XYZPoint
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:40
tuple muons
Definition: patZpeak.py:38
std::vector< unsigned int > evtsToDebug_
int id() const
the index in FBaseSimEvent and other vectors
Definition: FSimTrack.h:86
bool preshowerPresent() const
void setPulledPadSurvivalProbability(double val)
Definition: EcalHitMaker.h:132
const RawParticle & layer2Entrance() const
The particle at Preshower Layer 2.
Definition: FSimTrack.h:130
int onLayer1() const
Definition: FSimTrack.h:91
std::vector< double > k_e
std::vector< GflashHit > & getGflashHitList()
int onHcal() const
Definition: FSimTrack.h:106
void setTkMomentum(const math::XYZTLorentzVectorD &mom)
Definition: SimTrack.h:42
const RawParticle & hcalEntrance() const
The particle at HCAL entrance.
Definition: FSimTrack.h:136
void setMipEnergy(double e1, double e2)
tuple cout
Definition: gather_cfg.py:121
void setPreshowerPresent(bool ps)
Definition: EcalHitMaker.h:137
double getHCALEnergyResolution(double e, int hit)
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
tuple status
Definition: ntuplemaker.py:245
EnergyLossSimulator * energyLossSimulator() const
Return the Energy Loss engine.
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
const std::map< uint32_t, float > & getHits()
not been done.
bool addHit(double r, double phi, unsigned layer=0)
add the hit in the HCAL in local coordinates
Definition: HcalHitMaker.cc:28
HSParameters * myHSParameters_
std::vector< SimTrack > SimTrackContainer
tuple size
Write out results.
void setVertex(const XYZTLorentzVector &vtx)
set the vertex
Definition: RawParticle.h:287
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
bool setDepth(double, bool inCm=false)
set the depth in X0 or Lambda0 units depending on showerType
int hashed_index() const
Definition: HcalDetId.cc:119
void initialize(int showerType, double energy, double globalTime, double charge, Gflash3Vector &position, Gflash3Vector &momentum)
bool computeShower()
Definition: HDRShower.cc:47
void reconstructHCAL(const FSimTrack &myTrack)
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15
void print() const
print the FBaseSimEvent in an intelligible way
void setHcal(HcalHitMaker *const myHcal)
set the HCAL address
Definition: EMShower.cc:741
void setGrid(EcalHitMaker *const myGrid)
set the grid address
Definition: EMShower.h:64
FSimTrack & track(int id) const
Return track with given Id.
double getMaximumOfShower() const
get the depth of the centre of gravity of the shower(s)
Definition: EMShower.h:61
void loadFromEcalBarrel(edm::PCaloHitContainer &c) const