#include <FastSimulation/ShowerDevelopment/interface/HFShower.h>
Public Types | |
typedef std::pair< XYZPoint, double > | Spot |
typedef std::pair< unsigned int, double > | Step |
typedef Steps::const_iterator | step_iterator |
typedef std::vector< Step > | Steps |
typedef math::XYZVector | XYZPoint |
Public Member Functions | |
bool | compute () |
Compute the shower longitudinal and lateral development. | |
int | getHits (G4Step *aStep) |
double | getTSlice (int i) |
HFShower (std::string &name, const DDCompactView &cpv, edm::ParameterSet const &p) | |
HFShower (const RandomEngine *engine, HDShowerParametrization *myParam, EcalHitMaker *myGrid, HcalHitMaker *myHcalHitMaker, int onECAL, double epart) | |
virtual | ~HFShower () |
virtual | ~HFShower () |
Private Member Functions | |
void | clearHits () |
double | fibreLength (G4String) |
double | gam (double x, double a) const |
int | indexFinder (double x, const std::vector< double > &Fhist) |
void | makeSteps (int nsteps) |
double | transProb (double factor, double R, double r) |
Private Attributes | |
double | aloge |
double | alpEM |
double | alpHD |
double | balanceEH |
double | betEM |
double | betHD |
HFCherenkov * | cherenkov |
double | criticalEnergy |
double | depthStart |
double | depthStep |
std::vector< int > | detector |
double | e |
double | eSpotSize |
std::vector< double > | eStep |
HFFibre * | fibre |
std::map< G4String, double > | fibreDz2 |
double | hcalDepthFactor |
int | infinity |
double | lambdaEM |
double | lambdaHD |
std::vector< double > | lamcurr |
std::vector< double > | lamdepth |
std::vector< double > | lamstep |
std::vector< double > | lamtotal |
int | lossesOpt |
double | maxTRfactor |
int | nDepthSteps |
int | nHit |
std::vector< int > | nspots |
int | nTRsteps |
int | onEcal |
double | part |
double | probMax |
const RandomEngine * | random |
std::vector< double > | rlamStep |
double | tgamEM |
double | tgamHD |
const ECALProperties * | theECALproperties |
EcalHitMaker * | theGrid |
HcalHitMaker * | theHcalHitMaker |
const HCALProperties * | theHCALproperties |
HDShowerParametrization * | theParam |
double | theR1 |
double | theR2 |
double | theR3 |
std::vector< double > | timHit |
double | transFactor |
double | transParam |
std::vector< double > | wlHit |
std::vector< double > | x0curr |
std::vector< double > | x0depth |
double | x0EM |
double | x0HD |
Definition at line 22 of file HFShower.h.
typedef std::pair<XYZPoint,double> HFShower::Spot |
Definition at line 29 of file HFShower.h.
typedef std::pair<unsigned int, double> HFShower::Step |
Definition at line 30 of file HFShower.h.
typedef Steps::const_iterator HFShower::step_iterator |
Definition at line 32 of file HFShower.h.
typedef std::vector<Step> HFShower::Steps |
Definition at line 31 of file HFShower.h.
typedef math::XYZVector HFShower::XYZPoint |
Definition at line 27 of file HFShower.h.
HFShower::HFShower | ( | const RandomEngine * | engine, | |
HDShowerParametrization * | myParam, | |||
EcalHitMaker * | myGrid, | |||
HcalHitMaker * | myHcalHitMaker, | |||
int | onECAL, | |||
double | epart | |||
) |
Definition at line 30 of file HFShower.cc.
References aloge, HDShowerParametrization::alpe1(), HDShowerParametrization::alpe2(), alpEM, HDShowerParametrization::alph1(), HDShowerParametrization::alph2(), alpHD, balanceEH, HDShowerParametrization::bete1(), HDShowerParametrization::bete2(), betEM, HDShowerParametrization::beth1(), HDShowerParametrization::beth2(), betHD, criticalEnergy, debug, depthStart, depthStep, detector, e, HDShowerParametrization::e1(), HDShowerParametrization::e2(), EcalHitMaker::ecalHcalGapTotalL0(), EcalHitMaker::ecalHcalGapTotalX0(), HDShowerParametrization::ecalProperties(), EcalHitMaker::ecalTotalL0(), HDShowerParametrization::emax(), HDShowerParametrization::emid(), HDShowerParametrization::emin(), lat::endl(), eSpotSize, RandomEngine::flatShoot(), HSParameters::getHDbalanceEH(), HSParameters::getHDcriticalEnergy(), HSParameters::getHDdepthStep(), HSParameters::getHDeSpotSize(), HSParameters::getHDhcalDepthFactor(), HSParameters::getHDlossesOpt(), HSParameters::getHDmaxTRfactor(), HSParameters::getHDnDepthSteps(), HSParameters::getHDnTRsteps(), HSParameters::getHDtransParam(), hcalDepthFactor, HDShowerParametrization::hcalProperties(), EcalHitMaker::hcalTotalL0(), HDShowerParametrization::hsParameters(), i, HCALProperties::interactionLength(), ECALProperties::interactionLength(), lambdaEM, lambdaHD, lamcurr, lamdepth, lamstep, lamtotal, funct::log(), LogDebug, lossesOpt, makeSteps(), maxTRfactor, nDepthSteps, nTRsteps, onEcal, HDShowerParametrization::part1(), HDShowerParametrization::part2(), HDShowerParametrization::r1(), HDShowerParametrization::r2(), HDShowerParametrization::r3(), ECALProperties::radLenIncm(), HCALProperties::radLenIncm(), random, HDShowerParametrization::setCase(), tgamEM, tgamHD, theECALproperties, theGrid, theHCALproperties, theParam, theR1, theR2, theR3, transFactor, transParam, x0curr, x0depth, x0EM, and x0HD.
00036 : theParam(myParam), 00037 theGrid(myGrid), 00038 theHcalHitMaker(myHcalHitMaker), 00039 onEcal(onECAL), 00040 e(epart), 00041 random(engine) 00042 { 00043 // To get an access to constants read in FASTCalorimeter 00044 // FASTCalorimeter * myCalorimeter= FASTCalorimeter::instance(); 00045 00046 // Values taken from FamosGeneric/FamosCalorimeter/src/FASTCalorimeter.cc 00047 lossesOpt = myParam->hsParameters()->getHDlossesOpt(); 00048 nDepthSteps = myParam->hsParameters()->getHDnDepthSteps(); 00049 nTRsteps = myParam->hsParameters()->getHDnTRsteps(); 00050 transParam = myParam->hsParameters()->getHDtransParam(); 00051 eSpotSize = myParam->hsParameters()->getHDeSpotSize(); 00052 depthStep = myParam->hsParameters()->getHDdepthStep(); 00053 criticalEnergy = myParam->hsParameters()->getHDcriticalEnergy(); 00054 maxTRfactor = myParam->hsParameters()->getHDmaxTRfactor(); 00055 balanceEH = myParam->hsParameters()->getHDbalanceEH(); 00056 hcalDepthFactor = myParam->hsParameters()->getHDhcalDepthFactor(); 00057 00058 //============================================================================================ 00059 // Special treatment for HF 00060 // overwrite some parametrisations 00061 // - eSpotSize is the "average" energy per PE needed to make the 00062 // longitudinal and transverse profile (makeSteps) 00063 //============================================================================================ 00064 00065 double PPEperGeV = 0.25; 00066 eSpotSize = 1./PPEperGeV; 00067 00068 //============================================================================================ 00069 00070 // Special tr.size fluctuations 00071 transParam *= (1. + random->flatShoot()); 00072 00073 // Special long. fluctuations 00074 hcalDepthFactor += 0.05 * (2.* random->flatShoot() - 1.); 00075 00076 transFactor = 1.; // normally 1, in HF - might be smaller 00077 // to take into account 00078 // a narrowness of the HF shower (Cherenkov light) 00079 00080 // simple protection ... 00081 if(e < 0) e = 0.; 00082 00083 // Get the Famos Histos pointer 00084 // myHistos = FamosHistos::instance(); 00085 // std::cout << " Hello FamosShower " << std::endl; 00086 00087 theECALproperties = theParam->ecalProperties(); 00088 theHCALproperties = theParam->hcalProperties(); 00089 00090 double emax = theParam->emax(); 00091 double emid = theParam->emid(); 00092 double emin = theParam->emin(); 00093 double effective = e; 00094 00095 00096 if( e < emid ) { 00097 theParam->setCase(1); 00098 // avoid "underflow" below Emin (for parameters calculation only) 00099 if(e < emin) effective = emin; 00100 } 00101 else 00102 theParam->setCase(2); 00103 00104 // PV: Commented 00105 // Avoid "overflow" beyond Emax (for parameters) 00106 if(effective > 0.5 * emax) { 00107 eSpotSize *= 2.5; 00108 if(effective > emax) { 00109 effective = emax; 00110 eSpotSize *= 2.; 00111 depthStep *= 2.; 00112 } 00113 } 00114 00115 if(debug == 2 ) 00116 LogDebug("FastCalorimetry") << " HFShower : " << std::endl 00117 << " Energy " << e << std::endl 00118 << " lossesOpt " << lossesOpt << std::endl 00119 << " nDepthSteps " << nDepthSteps << std::endl 00120 << " nTRsteps " << nTRsteps << std::endl 00121 << " transParam " << transParam << std::endl 00122 << " eSpotSize " << eSpotSize << std::endl 00123 << " criticalEnergy " << criticalEnergy << std::endl 00124 << " maxTRfactor " << maxTRfactor << std::endl 00125 << " balanceEH " << balanceEH << std::endl 00126 << "hcalDepthFactor " << hcalDepthFactor << std::endl; 00127 00128 00129 double alpEM1 = theParam->alpe1(); 00130 double alpEM2 = theParam->alpe2(); 00131 00132 double betEM1 = theParam->bete1(); 00133 double betEM2 = theParam->bete2(); 00134 00135 double alpHD1 = theParam->alph1(); 00136 double alpHD2 = theParam->alph2(); 00137 00138 double betHD1 = theParam->beth1(); 00139 double betHD2 = theParam->beth2(); 00140 00141 double part1 = theParam->part1(); 00142 double part2 = theParam->part2(); 00143 00144 aloge = std::log(effective); 00145 00146 double edpar = (theParam->e1() + aloge * theParam->e2()) * effective; 00147 double aedep = std::log(edpar); 00148 00149 if(debug == 2) 00150 LogDebug("FastCalorimetry") << " HFShower : " << std::endl 00151 << " edpar " << edpar << " aedep " << aedep << std::endl 00152 << " alpEM1 " << alpEM1 << std::endl 00153 << " alpEM2 " << alpEM2 << std::endl 00154 << " betEM1 " << betEM1 << std::endl 00155 << " betEM2 " << betEM2 << std::endl 00156 << " alpHD1 " << alpHD1 << std::endl 00157 << " alpHD2 " << alpHD2 << std::endl 00158 << " betHD1 " << betHD1 << std::endl 00159 << " betHD2 " << betHD2 << std::endl 00160 << " part1 " << part1 << std::endl 00161 << " part2 " << part2 << std::endl; 00162 00163 // private members to set 00164 theR1 = theParam->r1(); 00165 theR2 = theParam->r2(); 00166 theR3 = theParam->r3(); 00167 00168 alpEM = alpEM1 + alpEM2 * aedep; 00169 tgamEM = tgamma(alpEM); 00170 betEM = betEM1 - betEM2 * aedep; 00171 alpHD = alpHD1 + alpHD2 * aedep; 00172 tgamHD = tgamma(alpHD); 00173 betHD = betHD1 - betHD2 * aedep; 00174 part = part1 - part2 * aedep; 00175 if(part > 1.) part = 1.; // protection - just in case of 00176 00177 if(debug == 2 ) 00178 LogDebug("FastCalorimetry") << " HFShower : " << std::endl 00179 << " alpEM " << alpEM << std::endl 00180 << " tgamEM " << tgamEM << std::endl 00181 << " betEM " << betEM << std::endl 00182 << " alpHD " << alpHD << std::endl 00183 << " tgamHD " << tgamHD << std::endl 00184 << " betHD " << betHD << std::endl 00185 << " part " << part << std::endl; 00186 00187 00188 if(onECAL){ 00189 lambdaEM = theParam->ecalProperties()->interactionLength(); 00190 x0EM = theParam->ecalProperties()->radLenIncm(); 00191 } 00192 else { 00193 lambdaEM = 0.; 00194 x0EM = 0.; 00195 } 00196 lambdaHD = theParam->hcalProperties()->interactionLength(); 00197 x0HD = theParam->hcalProperties()->radLenIncm(); 00198 00199 if(debug == 2) 00200 LogDebug("FastCalorimetry") << " HFShower e " << e << std::endl 00201 << " x0EM = " << x0EM << std::endl 00202 << " x0HD = " << x0HD << std::endl 00203 << " lamEM = " << lambdaEM << std::endl 00204 << " lamHD = " << lambdaHD << std::endl; 00205 00206 00207 // Starting point of the shower 00208 // try first with ECAL lambda 00209 00210 double sum1 = 0.; // lambda path from the ECAL/HF entrance; 00211 double sum2 = 0.; // lambda path from the interaction point; 00212 double sum3 = 0.; // x0 path from the interaction point; 00213 int nsteps = 0; // full number of longitudinal steps (counter); 00214 00215 int nmoresteps; // how many longitudinal steps in addition to 00216 // one (if interaction happens there) in ECAL 00217 00218 00219 if(e < criticalEnergy ) nmoresteps = 1; 00220 else nmoresteps = nDepthSteps; 00221 00222 double depthECAL = 0.; 00223 double depthGAP = 0.; 00224 double depthGAPx0 = 0.; 00225 if(onECAL ) { 00226 depthECAL = theGrid->ecalTotalL0(); // ECAL depth segment 00227 depthGAP = theGrid->ecalHcalGapTotalL0(); // GAP depth segment 00228 depthGAPx0 = theGrid->ecalHcalGapTotalX0(); // GAP depth x0 00229 } 00230 00231 double depthHCAL = theGrid->hcalTotalL0(); // HCAL depth segment 00232 double depthToHCAL = depthECAL + depthGAP; 00233 00234 //--------------------------------------------------------------------------- 00235 // Depth simulation & various protections, among them 00236 // if too deep - get flat random in the allowed region 00237 // if no HCAL material behind - force to deposit in ECAL 00238 double maxDepth = depthToHCAL + depthHCAL - 1.1 * depthStep; 00239 00240 // PV : increase by 0.8lambda (i.e. 12 cm) 00241 // Tuning 00242 double depthStart = 0.8 + std::log(1./random->flatShoot()); // starting point lambda unts 00243 00244 if(e < emin) { 00245 if(debug) 00246 LogDebug("FastCalorimetry") << " FamosHFShower : e <emin -> depthStart = 0" << std::endl; 00247 depthStart = 0.; 00248 } 00249 00250 if(depthStart > maxDepth) { 00251 if(debug) LogDebug("FastCalorimetry") << " FamosHFShower : depthStart too big ... = " 00252 << depthStart << std::endl; 00253 00254 depthStart = maxDepth * random->flatShoot(); 00255 if( depthStart < 0.) depthStart = 0.; 00256 if(debug) LogDebug("FastCalorimetry") << " FamosHFShower : depthStart re-calculated = " 00257 << depthStart << std::endl; 00258 } 00259 00260 if( onECAL && e < emid ) { 00261 if((depthECAL - depthStart)/depthECAL > 0.2 && depthECAL > depthStep ) { 00262 00263 depthStart = 0.5 * depthECAL * random->flatShoot(); 00264 if(debug) 00265 LogDebug("FastCalorimetry") << " FamosHFShower : small energy, " 00266 << " depthStart reduced to = " << depthStart << std::endl; 00267 00268 } 00269 } 00270 00271 if( depthHCAL < depthStep) { 00272 if(debug) LogDebug("FastCalorimetry") << " FamosHFShower : depthHCAL too small ... = " 00273 << depthHCAL << " depthStart -> forced to 0 !!!" 00274 << std::endl; 00275 depthStart = 0.; 00276 nmoresteps = 0; 00277 00278 if(depthECAL < depthStep) { 00279 nsteps = -1; 00280 LogInfo("FastCalorimetry") << " FamosHFShower : too small ECAL and HCAL depths - " 00281 << " particle is lost !!! " << std::endl; 00282 } 00283 } 00284 00285 if(debug) 00286 LogDebug("FastCalorimetry") << " FamosHFShower depths(lam) - " << std::endl 00287 << " ECAL = " << depthECAL << std::endl 00288 << " GAP = " << depthGAP << std::endl 00289 << " HCAL = " << depthHCAL << std::endl 00290 << " starting point = " << depthStart << std::endl; 00291 00292 // PV 00293 // std::cout << " FamosHFShower depths(lam) - " << std::endl 00294 // << " ECAL = " << depthECAL << std::endl 00295 // << " GAP = " << depthGAP << std::endl 00296 // << " HCAL = " << depthHCAL << std::endl 00297 // << " starting point = " << depthStart << std::endl; 00298 00299 if( onEcal ) { 00300 if(debug) LogDebug("FastCalorimetry") << " FamosHFShower : onECAL" << std::endl; 00301 if(depthStart < depthECAL) { 00302 if(debug) LogDebug("FastCalorimetry") << " FamosHFShower : depthStart < depthECAL" << std::endl; 00303 if((depthECAL - depthStart)/depthECAL > 0.25 && depthECAL > depthStep) { 00304 if(debug) LogDebug("FastCalorimetry") << " FamosHFShower : enough space to make ECAL step" 00305 << std::endl; 00306 // ECAL - one step 00307 nsteps++; 00308 sum1 += depthECAL; // at the end of step 00309 sum2 += depthECAL-depthStart; 00310 sum3 += sum2 * lambdaEM / x0EM; 00311 lamtotal.push_back(sum1); 00312 lamdepth.push_back(sum2); 00313 lamcurr.push_back(lambdaEM); 00314 lamstep.push_back(depthECAL-depthStart); 00315 x0depth.push_back(sum3); 00316 x0curr.push_back(x0EM); 00317 detector.push_back(1); 00318 00319 if(debug) LogDebug("FastCalorimetry") << " FamosHFShower : " << " in ECAL sum1, sum2 " 00320 << sum1 << " " << sum2 << std::endl; 00321 00322 // // Gap - no additional step after ECAL 00323 // // just move further to HCAL over the gap 00324 sum1 += depthGAP; 00325 sum2 += depthGAP; 00326 sum3 += depthGAPx0; 00327 } 00328 // Just shift starting point to HCAL 00329 else { 00330 // cout << " FamosHFShower : not enough space to make ECAL step" << std::endl; 00331 if(debug) LogDebug("FastCalorimetry") << " FamosHFShower : goto HCAL" << std::endl; 00332 00333 depthStart = depthToHCAL; 00334 sum1 += depthStart; 00335 } 00336 } 00337 else { // GAP or HCAL 00338 00339 if(depthStart >= depthECAL && depthStart < depthToHCAL ) { 00340 depthStart = depthToHCAL; // just a shift to HCAL for simplicity 00341 } 00342 sum1 += depthStart; 00343 00344 if(debug) LogDebug("FastCalorimetry") << " FamosHFShower : goto HCAL" << std::endl; 00345 } 00346 } 00347 else { // Forward 00348 if(debug) LogDebug("FastCalorimetry") << " FamosHFShower : forward" << std::endl; 00349 sum1 += depthStart; 00350 // PV : 1.0 instead of 0.5 00351 transFactor = 1.0; // makes narower tresverse size of shower 00352 } 00353 00354 for (int i = 0; i < nmoresteps ; i++) { 00355 sum1 += depthStep; 00356 if (sum1 > (depthECAL + depthGAP + depthHCAL)) break; 00357 sum2 += depthStep; 00358 sum3 += sum2 * lambdaHD / x0HD; 00359 lamtotal.push_back(sum1); 00360 lamdepth.push_back(sum2); 00361 lamcurr.push_back(lambdaHD); 00362 lamstep.push_back(depthStep); 00363 x0depth.push_back(sum3); 00364 x0curr.push_back(x0HD); 00365 detector.push_back(3); 00366 nsteps++; 00367 } 00368 00369 00370 // Make fractions of energy and transverse radii at each step 00371 00372 // PV 00373 // std::cout << "HFShower::HFShower() : Nsteps = " << nsteps << std::endl; 00374 00375 if(nsteps > 0) { makeSteps(nsteps); } 00376 00377 }
HFShower::~HFShower | ( | ) | [inline, virtual] |
HFShower::HFShower | ( | std::string & | name, | |
const DDCompactView & | cpv, | |||
edm::ParameterSet const & | p | |||
) |
Definition at line 20 of file HFShower.cc.
References DDFilteredView::addFilter(), cherenkov, clearHits(), DDSplit(), DDSpecificsFilter::equals, fibre, fibreDz2, filter, first, DDFilteredView::firstChild(), edm::ParameterSet::getParameter(), i, DDFilteredView::logicalPart(), DDBase< N, C >::name(), DDFilteredView::next(), nHit, DDSolid::parameters(), probMax, DDSpecificsFilter::setCriteria(), DDSolid::shape(), DDLogicalPart::solid(), tmp, and value.
00021 : cherenkov(0), fibre(0) { 00022 00023 edm::ParameterSet m_HF = p.getParameter<edm::ParameterSet>("HFShower"); 00024 //static SimpleConfigurable<double> cf1(0.5, "HFShower:CFibre"); 00025 //static SimpleConfigurable<float> pPr(0.7268,"VCalShowerLibrary:ProbMax"); 00026 probMax = m_HF.getParameter<double>("ProbMax"); 00027 00028 edm::LogInfo("HFShower") << "HFShower:: Maximum probability cut off " 00029 << probMax; 00030 00031 G4String attribute = "Volume"; 00032 G4String value = "HFFibre"; 00033 DDSpecificsFilter filter; 00034 DDValue ddv(attribute,value,0); 00035 filter.setCriteria(ddv,DDSpecificsFilter::equals); 00036 DDFilteredView fv(cpv); 00037 fv.addFilter(filter); 00038 00039 bool dodet = fv.firstChild(); 00040 std::vector<G4String> tmp; 00041 while (dodet) { 00042 const DDSolid & sol = fv.logicalPart().solid(); 00043 const std::vector<double> & paras = sol.parameters(); 00044 G4String name = DDSplit(sol.name()).first; 00045 bool ok = true; 00046 for (unsigned int i=0; i<tmp.size(); i++) 00047 if (name == tmp[i]) ok = false; 00048 if (ok) { 00049 tmp.push_back(name); 00050 fibreDz2.insert(std::pair<G4String,double>(name,paras[0])); 00051 edm::LogInfo("HFShower") << "HFShower::initMap (for " << value 00052 << "): Solid " << name << " Shape " 00053 << sol.shape() << " Parameter 0 = " << paras[0]; 00054 } 00055 dodet = fv.next(); 00056 } 00057 00058 cherenkov = new HFCherenkov(p); 00059 fibre = new HFFibre(name, cpv, p); 00060 00061 nHit = 0; 00062 clearHits(); 00063 }
virtual HFShower::~HFShower | ( | ) | [virtual] |
void HFShower::clearHits | ( | ) | [private] |
bool HFShower::compute | ( | ) |
Compute the shower longitudinal and lateral development.
Definition at line 493 of file HFShower.cc.
References EcalHitMaker::addHit(), HcalHitMaker::addHit(), count, debug, detector, ReconstructionGR_cff::ecal, lat::endl(), eStep, RandomEngine::flatShoot(), RandomEngine::gaussShoot(), EcalHitMaker::getPads(), hcalDepthFactor, i, index, indexFinder(), infinity, j, lamstep, lamtotal, LogDebug, lossesOpt, maxTRfactor, nspots, nTRsteps, phi, radius(), random, HLT_VtxMuL3::result, rlamStep, HcalHitMaker::setDepth(), HcalHitMaker::setSpotEnergy(), EcalHitMaker::setSpotEnergy(), StDecayID::status, theGrid, theHcalHitMaker, and transProb().
Referenced by CalorimetryManager::HDShowerSimulation().
00493 { 00494 00495 // TimeMe theT("FamosHFShower::compute"); 00496 00497 bool status = false; 00498 int numLongit = eStep.size(); 00499 if(debug) 00500 LogDebug("FastCalorimetry") << " FamosHFShower::compute - " 00501 << " N_long.steps required : " << numLongit << std::endl; 00502 00503 if(numLongit > 0) { 00504 00505 status = true; 00506 // Prepare the trsanverse probability function 00507 std::vector<double> Fhist; 00508 std::vector<double> rhist; 00509 for (int j = 0; j < nTRsteps + 1; j++) { 00510 rhist.push_back(maxTRfactor * j / nTRsteps ); 00511 Fhist.push_back(transProb(maxTRfactor,1.,rhist[j])); 00512 if(debug == 3) 00513 LogDebug("FastCalorimetry") << "indexFinder - i, Fhist[i] = " << j << " " << Fhist[j] << std::endl; 00514 } 00515 00516 //==================================================================================== 00517 // Longitudinal steps 00518 //==================================================================================== 00519 for (int i = 0; i < numLongit ; i++) { 00520 00521 double currentDepthL0 = lamtotal[i] - 0.5 * lamstep[i]; 00522 // vary the longitudinal profile if needed 00523 if(detector[i] != 1) currentDepthL0 *= hcalDepthFactor; 00524 if(debug) 00525 LogDebug("FastCalorimetry") << " FamosHFShower::compute - detector = " 00526 << detector[i] 00527 << " currentDepthL0 = " 00528 << currentDepthL0 << std::endl; 00529 00530 double maxTRsize = maxTRfactor * rlamStep[i]; // in lambda units 00531 double rbinsize = maxTRsize / nTRsteps; 00532 double espot = eStep[i] / (double)nspots[i]; // re-adjust espot 00533 00534 // PV changed 00535 // if(espot > 2. || espot < 0. ) 00536 if( espot < 0. ) 00537 LogDebug("FastCalorimetry") << " FamosHFShower::compute - unphysical espot = " 00538 << espot << std::endl; 00539 00540 int ecal = 0; 00541 if(detector[i] != 1) { 00542 bool setHDdepth = theHcalHitMaker->setDepth(currentDepthL0); 00543 00544 if(debug) 00545 LogDebug("FastCalorimetry") << " FamosHFShower::compute - status of " 00546 << " theHcalHitMaker->setDepth(currentDepthL0) is " 00547 << setHDdepth << std::endl; 00548 00549 if(!setHDdepth) 00550 { 00551 currentDepthL0 -= lamstep[i]; 00552 setHDdepth = theHcalHitMaker->setDepth(currentDepthL0); 00553 } 00554 if(!setHDdepth) continue; 00555 00556 theHcalHitMaker->setSpotEnergy(espot); 00557 } 00558 else { 00559 ecal = 1; 00560 bool status = theGrid->getPads(currentDepthL0); 00561 00562 if(debug) 00563 LogDebug("FastCalorimetry") << " FamosHFShower::compute - status of Grid = " 00564 << status << std::endl; 00565 00566 if(!status) continue; 00567 00568 theGrid->setSpotEnergy(espot); 00569 } 00570 00571 // PV : 00572 // std::cout << "Longitudinal layer " << i << " : " 00573 // << "E layer = " << eStep[i] << " " 00574 // << "N spot = " << nspots[i] << " " 00575 // << "E spot = " << espot << " " 00576 // << "Depth = " << currentDepthL0 00577 // << std::endl; 00578 00579 //--------------------------------------------------------------------------------------- 00580 // Transverse distribution 00581 //--------------------------------------------------------------------------------------- 00582 int nok = 0; // counter of OK 00583 int count = 0; 00584 int inf = infinity; 00585 if(lossesOpt) inf = nspots[i]; // losses are enabled, otherwise 00586 // only OK points are counted ... 00587 00588 // Total energy in this layer 00589 double eremaining = eStep[i]; 00590 bool converged = false; 00591 00592 while (eremaining > 0. && !converged && count<infinity ) { 00593 00594 ++count; 00595 00596 // Generate Energy per PE for long fibers 00597 00598 double GeVperPE = 1./0.25; 00599 double GeVperPEwidth = 0.3 * GeVperPE; 00600 00601 // PV 00602 // We need to know a priori if this energy spot if for a long (1) or short (2) fiber 00603 // because resolutions/GeV per PE are not the same 00604 00605 unsigned layer = random->flatShoot() < 0.66 ? 1 : 2; 00606 if ( layer == 2 ) { 00607 GeVperPE = 1./0.125; 00608 GeVperPEwidth = 0.3 * GeVperPE; 00609 } 00610 00611 double newespot = random->gaussShoot(GeVperPE,GeVperPEwidth); 00612 if ( newespot < 0. ) newespot = GeVperPE; 00613 00614 if ( eremaining - newespot < 0. ) newespot = eremaining; 00615 00616 // process transverse distribution 00617 00618 double prob = random->flatShoot(); 00619 int index = indexFinder(prob,Fhist); 00620 double radius = rlamStep[i] * rhist[index] + 00621 random->flatShoot() * rbinsize; // in-bin 00622 double phi = 2.*M_PI*random->flatShoot(); 00623 00624 if(debug == 2) 00625 LogDebug("FastCalorimetry") << std::endl << " FamosHFShower::compute " << " r = " << radius 00626 << " phi = " << phi << std::endl; 00627 00628 // add hit 00629 00630 theHcalHitMaker->setSpotEnergy(newespot); 00631 theGrid->setSpotEnergy(newespot); 00632 00633 bool result; 00634 if(ecal) { 00635 result = theGrid->addHit(radius,phi,0); 00636 00637 if(debug == 2) 00638 LogDebug("FastCalorimetry") << " FamosHFShower::compute - " 00639 << " theGrid->addHit result = " 00640 << result << std::endl; 00641 } 00642 else { 00643 // PV assign espot to lon/short fibers 00644 result = theHcalHitMaker->addHit(radius,phi,layer); 00645 00646 // std::cout << "Transverse : " << nok << " " 00647 // << " , E= " << newespot 00648 // << " , Layer = " << layer 00649 // << " , Erem = " << eremaining- newespot 00650 // << std::endl; 00651 00652 if(debug == 2) 00653 LogDebug("FastCalorimetry") << " FamosHFShower::compute - " 00654 << " theHcalHitMaker->addHit result = " 00655 << result << std::endl; 00656 } 00657 00658 if (result) { 00659 ++nok; 00660 eremaining -= newespot; 00661 if ( eremaining <= 0. ) converged = true; 00662 // std::cout << "Transverse : " << nok << " " 00663 // << " , E= " << newespot 00664 // << " , Erem = " << eremaining 00665 // << std::endl; 00666 } else { 00667 // std::cout << "WARNING : hit not added" << std::endl; 00668 } 00669 } 00670 00671 // PV : old code 00672 // for (int j = 0; j < inf; j++) { 00673 // if(nok == nspots[i]) break; 00674 // count ++; 00675 00676 // double prob = random->flatShoot(); 00677 // int index = indexFinder(prob,Fhist); 00678 // double radius = rlamStep[i] * rhist[index] + 00679 // random->flatShoot() * rbinsize; // in-bin 00680 // double phi = 2.*M_PI*random->flatShoot(); 00681 00682 // if(debug == 2) 00683 // LogDebug("FastCalorimetry") << std::endl << " FamosHFShower::compute " << " r = " << radius 00684 // << " phi = " << phi << std::endl; 00685 00686 // bool result; 00687 // if(ecal) { 00688 // result = theGrid->addHit(radius,phi,0); 00689 00690 // if(debug == 2) 00691 // LogDebug("FastCalorimetry") << " FamosHFShower::compute - " 00692 // << " theGrid->addHit result = " 00693 // << result << std::endl; 00694 // } 00695 // else { 00696 // result = theHcalHitMaker->addHit(radius,phi,0); 00697 00698 // if(debug == 2) 00699 // LogDebug("FastCalorimetry") << " FamosHFShower::compute - " 00700 // << " theHcalHitMaker->addHit result = " 00701 // << result << std::endl; 00702 // } 00703 // if(result) nok ++; 00704 // } 00705 // end of tranverse simulation 00706 //--------------------------------------------------------------------------------------- 00707 00708 if(count == infinity) { 00709 status = false; 00710 if(debug) 00711 LogDebug("FastCalorimetry") << "*** FamosHFShower::compute " << " maximum number of" 00712 << " transverse points " << count << " is used !!!" << std::endl; 00713 break; 00714 } 00715 00716 if(debug) 00717 LogDebug("FastCalorimetry") << " FamosHFShower::compute " << " long.step No." << i 00718 << " Ntry, Nok = " << count 00719 << " " << nok << std::endl; 00720 00721 } // end of longitudinal steps 00722 } // end of no steps 00723 return status; 00724 00725 }
double HFShower::fibreLength | ( | G4String | name | ) | [private] |
double HFShower::gam | ( | double | x, | |
double | a | |||
) | const [inline, private] |
Definition at line 49 of file HFShower.h.
References funct::exp(), and funct::pow().
Referenced by makeSteps().
int HFShower::getHits | ( | G4Step * | aStep | ) |
Definition at line 70 of file HFShower.cc.
References HFFibre::attLength(), cherenkov, clearHits(), HFCherenkov::computeNPE(), relval_parameters_module::energy, funct::exp(), fibre, fibreLength(), HFCherenkov::getWL(), i, LogDebug, name, nHit, p, probMax, r1, r2, timHit, HFFibre::tShift(), v, w, and wlHit.
Referenced by HCalSD::hitForFibre().
00070 { 00071 00072 clearHits(); 00073 int nHit = 0; 00074 00075 double edep = aStep->GetTotalEnergyDeposit(); 00076 double stepl = 0.; 00077 00078 if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() != 0.) 00079 stepl = aStep->GetStepLength(); 00080 if ((edep == 0.) || (stepl == 0.)) { 00081 LogDebug("HFShower") << "HFShower::getHits: Number of Hits " << nHit; 00082 return nHit; 00083 } 00084 00085 G4Track *aTrack = aStep->GetTrack(); 00086 const G4DynamicParticle *aParticle = aTrack->GetDynamicParticle(); 00087 00088 double energy = aParticle->GetTotalEnergy(); 00089 double momentum = aParticle->GetTotalMomentum(); 00090 double pBeta = momentum / energy; 00091 double dose = 0.; 00092 int npeDose = 0; 00093 00094 G4ThreeVector momentumDir = aParticle->GetMomentumDirection(); 00095 G4ParticleDefinition *particleDef = aTrack->GetDefinition(); 00096 00097 G4StepPoint * preStepPoint = aStep->GetPreStepPoint(); 00098 G4ThreeVector globalPos = preStepPoint->GetPosition(); 00099 G4String name = 00100 preStepPoint->GetTouchable()->GetSolid(0)->GetName(); 00101 G4ThreeVector localPos = preStepPoint->GetTouchable()->GetHistory()-> 00102 GetTopTransform().TransformPoint(globalPos); 00103 G4ThreeVector localMom = preStepPoint->GetTouchable()->GetHistory()-> 00104 GetTopTransform().TransformAxis(momentumDir); 00105 int depth = 00106 (preStepPoint->GetTouchable()->GetReplicaNumber(0))%10; 00107 00108 double u = localMom.x(); 00109 double v = localMom.y(); 00110 double w = localMom.z(); 00111 double zCoor = localPos.z(); 00112 double zFibre = (fibreLength(name)-zCoor); 00113 double tSlice = (aStep->GetPostStepPoint()->GetGlobalTime()); 00114 double time = fibre->tShift(globalPos, depth, false); 00115 00116 LogDebug("HFShower") << "HFShower::getHits: in " << name << " Z " << zCoor 00117 << " " << fibreLength(name) << " " << zFibre << " Time " 00118 << tSlice << " " << time 00119 << "\n Direction " << momentumDir 00120 << " Local " << localMom; 00121 00122 int npe = cherenkov->computeNPE(particleDef, pBeta, u, v, w, stepl, zFibre, 00123 dose, npeDose); 00124 std::vector<double> wavelength = cherenkov->getWL(); 00125 00126 for (int i = 0; i<npe; ++i) { 00127 double p = fibre->attLength(wavelength[i]); 00128 double r1 = G4UniformRand(); 00129 double r2 = G4UniformRand(); 00130 LogDebug("HFShower") << "HFShower::getHits: " << i << " attenuation " << r1 00131 <<":" << exp(-p*zFibre) << " r2 " << r2 << ":" 00132 << probMax << " Survive: " 00133 << (r1 <= exp(-p*zFibre) && r2 <= probMax); 00134 if (r1 <= exp(-p*zFibre) && r2 <= probMax) { 00135 nHit++; 00136 wlHit.push_back(wavelength[i]); 00137 timHit.push_back(tSlice+time); 00138 } 00139 } 00140 00141 LogDebug("HFShower") << "HFShower::getHits: Number of Hits " << nHit; 00142 for (int i=0; i<nHit; i++) 00143 LogDebug("HFShower") << "HFShower::Hit " << i << " WaveLength " << wlHit[i] 00144 << " Time " << timHit[i]; 00145 00146 return nHit; 00147 00148 }
double HFShower::getTSlice | ( | int | i | ) |
Definition at line 150 of file HFShower.cc.
References LogDebug, nHit, and timHit.
Referenced by HCalSD::hitForFibre().
00150 { 00151 00152 double tim = 0.; 00153 if (i < nHit) tim = timHit[i]; 00154 LogDebug("HFShower") << "HFShower: Time (" << i << "/" << nHit << ") " <<tim; 00155 return tim; 00156 }
int HFShower::indexFinder | ( | double | x, | |
const std::vector< double > & | Fhist | |||
) | [private] |
Definition at line 727 of file HFShower.cc.
References debug, lat::endl(), iter, LogDebug, size, and cmsRelvalreportInput::step.
Referenced by compute().
00727 { 00728 // binary search in the vector of doubles 00729 int size = Fhist.size(); 00730 00731 int curr = size / 2; 00732 int step = size / 4; 00733 int iter; 00734 int prevdir = 0; 00735 int actudir = 0; 00736 00737 for (iter = 0; iter < size ; iter++) { 00738 00739 if( curr >= size || curr < 1 ) 00740 LogError("FastCalorimetry") << " FamosHFShower::indexFinder - wrong current index = " 00741 << curr << " !!!" << std::endl; 00742 00743 if ((x <= Fhist[curr]) && (x > Fhist[curr-1])) break; 00744 prevdir = actudir; 00745 if(x > Fhist[curr]) {actudir = 1;} 00746 else {actudir = -1;} 00747 if(prevdir * actudir < 0) { if(step > 1) step /= 2;} 00748 curr += actudir * step; 00749 if(curr > size) curr = size; 00750 else { if(curr < 1) {curr = 1;}} 00751 00752 if(debug == 3) 00753 LogDebug("FastCalorimetry") << " indexFinder - end of iter." << iter 00754 << " curr, F[curr-1], F[curr] = " 00755 << curr << " " << Fhist[curr-1] << " " << Fhist[curr] << std::endl; 00756 00757 } 00758 00759 if(debug == 3) 00760 LogDebug("FastCalorimetry") << " indexFinder x = " << x << " found index = " << curr-1 00761 << std::endl; 00762 00763 00764 return curr-1; 00765 }
Definition at line 379 of file HFShower.cc.
References aloge, alpEM, alpHD, and, balanceEH, betEM, betHD, count, debug, detector, e, lat::endl(), eSpotSize, eStep, RandomEngine::flatShoot(), gam(), i, infinity, int, lamcurr, lamdepth, lamstep, LogDebug, nspots, random, rlamStep, sum(), pyDBSRunClass::temp, tgamEM, tgamHD, theR1, theR2, theR3, transFactor, transParam, x, x0curr, x0depth, and y.
Referenced by HFShower().
00379 { 00380 00381 double sumes = 0.; 00382 double sum = 0.; 00383 std::vector<double> temp; 00384 00385 00386 if(debug) 00387 LogDebug("FastCalorimetry") << " FamosHFShower::makeSteps - " 00388 << " nsteps required : " << nsteps << std::endl; 00389 00390 int count = 0; 00391 for (int i = 0; i < nsteps; i++) { 00392 00393 double deplam = lamdepth[i] - 0.5 * lamstep[i]; 00394 double depx0 = x0depth[i] - 0.5 * lamstep[i] / x0curr[i]; 00395 double x = betEM * depx0; 00396 double y = betHD * deplam; 00397 00398 if(debug == 2) 00399 LogDebug("FastCalorimetry") << " FamosHFShower::makeSteps " 00400 << " - step " << i 00401 << " depx0, x = " << depx0 << ", " << x 00402 << " deplam, y = " << deplam << ", " 00403 << y << std::endl; 00404 00405 double est = (part * betEM * gam(x,alpEM) * lamcurr[i] / 00406 (x0curr[i] * tgamEM) + 00407 (1.-part) * betHD * gam(y,alpHD) / tgamHD) * lamstep[i]; 00408 00409 // protection ... 00410 if(est < 0.) { 00411 LogDebug("FastCalorimetry") << "*** FamosHFShower::makeSteps " << " - negative step energy !!!" 00412 << std::endl; 00413 est = 0.; 00414 break ; 00415 } 00416 00417 // for estimates only 00418 sum += est; 00419 int nPest = (int) (est * e / sum / eSpotSize) ; 00420 00421 if(debug == 2) 00422 LogDebug("FastCalorimetry") << " FamosHFShower::makeSteps - nPoints estimate = " 00423 << nPest << std::endl; 00424 00425 if(nPest <= 1 && count !=0 ) break; 00426 00427 // good step - to proceed 00428 00429 temp.push_back(est); 00430 sumes += est; 00431 00432 rlamStep.push_back(transParam * (theR1 + (theR2 - theR3 * aloge)) 00433 * deplam * transFactor); 00434 count ++; 00435 } 00436 00437 // fluctuations in ECAL and re-distribution of remaining energy in HCAL 00438 if(detector[0] == 1 && count > 1) { 00439 double oldECALenergy = temp[0]; 00440 double oldHCALenergy = sumes - oldECALenergy ; 00441 double newECALenergy = 2. * sumes; 00442 for (int i = 0; newECALenergy > sumes && i < infinity; i++) 00443 newECALenergy = 2.* balanceEH * random->flatShoot() * oldECALenergy; 00444 00445 if(debug == 2) 00446 LogDebug("FastCalorimetry") << "*** FamosHFShower::makeSteps " << " ECAL fraction : old/new - " 00447 << oldECALenergy/sumes << "/" << newECALenergy/sumes << std::endl; 00448 00449 temp[0] = newECALenergy; 00450 double newHCALenergy = sumes - newECALenergy; 00451 double newHCALreweight = newHCALenergy / oldHCALenergy; 00452 00453 for (int i = 1; i < count; i++) { 00454 temp[i] *= newHCALreweight; 00455 } 00456 00457 } 00458 00459 00460 // final re-normalization of the energy fractions 00461 double etot = 0.; 00462 for (int i = 0; i < count ; i++) { 00463 eStep.push_back(temp[i] * e / sumes ); 00464 nspots.push_back((int)(eStep[i]/eSpotSize)+1); 00465 etot += eStep[i]; 00466 00467 if(debug) 00468 LogDebug("FastCalorimetry") << i << " xO and lamdepth at the end of step = " 00469 << x0depth[i] << " " 00470 << lamdepth[i] << " Estep func = " << eStep[i] 00471 << " Rstep = " << rlamStep[i] << " Nspots = " << nspots[i] 00472 << std::endl; 00473 00474 } 00475 // PV 00476 // std::cout << "Initial/Total energy = " 00477 // << e << " " 00478 // << etot 00479 // << std::endl; 00480 00481 // The only step is in ECAL - let's make the size bigger ... 00482 if(count == 1 and detector[0] == 1) rlamStep[0] *= 2.; 00483 00484 00485 if(debug) { 00486 if(eStep[0] > 0.95 * e && detector[0] == 1) 00487 LogDebug("FastCalorimetry") << " FamosHFShower::makeSteps - " << "ECAL energy = " << eStep[0] 00488 << " out of total = " << e << std::endl; 00489 } 00490 00491 }
double HFShower::transProb | ( | double | factor, | |
double | R, | |||
double | r | |||
) | [inline, private] |
double HFShower::aloge [private] |
double HFShower::alpEM [private] |
double HFShower::alpHD [private] |
double HFShower::balanceEH [private] |
double HFShower::betEM [private] |
double HFShower::betHD [private] |
HFCherenkov* HFShower::cherenkov [private] |
double HFShower::criticalEnergy [private] |
double HFShower::depthStart [private] |
double HFShower::depthStep [private] |
std::vector<int> HFShower::detector [private] |
double HFShower::e [private] |
double HFShower::eSpotSize [private] |
std::vector<double> HFShower::eStep [private] |
HFFibre* HFShower::fibre [private] |
std::map<G4String,double> HFShower::fibreDz2 [private] |
double HFShower::hcalDepthFactor [private] |
int HFShower::infinity [private] |
double HFShower::lambdaEM [private] |
double HFShower::lambdaHD [private] |
std::vector<double> HFShower::lamcurr [private] |
std::vector<double> HFShower::lamdepth [private] |
std::vector<double> HFShower::lamstep [private] |
std::vector<double> HFShower::lamtotal [private] |
int HFShower::lossesOpt [private] |
double HFShower::maxTRfactor [private] |
int HFShower::nDepthSteps [private] |
int HFShower::nHit [private] |
std::vector<int> HFShower::nspots [private] |
int HFShower::nTRsteps [private] |
int HFShower::onEcal [private] |
double HFShower::part [private] |
Definition at line 72 of file HFShower.h.
double HFShower::probMax [private] |
const RandomEngine* HFShower::random [private] |
std::vector<double> HFShower::rlamStep [private] |
double HFShower::tgamEM [private] |
double HFShower::tgamHD [private] |
const ECALProperties* HFShower::theECALproperties [private] |
EcalHitMaker* HFShower::theGrid [private] |
HcalHitMaker* HFShower::theHcalHitMaker [private] |
const HCALProperties* HFShower::theHCALproperties [private] |
HDShowerParametrization* HFShower::theParam [private] |
double HFShower::theR1 [private] |
double HFShower::theR2 [private] |
double HFShower::theR3 [private] |
std::vector<double> HFShower::timHit [private] |
double HFShower::transFactor [private] |
double HFShower::transParam [private] |
std::vector<double> HFShower::wlHit [private] |
std::vector<double> HFShower::x0curr [private] |
std::vector<double> HFShower::x0depth [private] |
double HFShower::x0EM [private] |
double HFShower::x0HD [private] |