75 useNM = s.Contains(
"nm") || s.Contains(
"null");
76 useJB = s.Contains(
"jb") || s.Contains(
"jacquet");
77 useDA = s.Contains(
"da") || s.Contains(
"double");
82 if (
unsigned(n) <
Devices.size()) {
98 typedef std::unique_ptr<erhic::DisKinematics> KinPtr;
99 if (
useNM && scattered) {
113 if (
useDA && scattered) {
122 std::list<Smearer*> devices;
126 std::vector<Smearer*>::const_iterator iter;
129 if ((*iter)->Accept.Is(p)) {
130 devices.push_back(*iter);
140 std::list<Smearer*> devices =
Accept(prt);
142 if (!devices.empty()) {
147 std::list<Smearer*>::iterator iter;
148 for (iter = devices.begin(); iter != devices.end(); ++iter) {
149 (*iter)->Smear(prt, *prtOut);
156 prtOut->
SetPt( sqrt(pow(prtOut->
GetPx(), 2.) + pow(prtOut->
GetPy(), 2.)));
163 if ( !prtOut->
IsSmeared() )
throw std::runtime_error (
"particle seems to be not smeared?!");
169 if ( MomComponentsChanged==0 ){
173 cerr <<
"Phi always needs to be smeared (at least with sigma=0)" << endl;
174 cerr <<
"For legacy smear scripts, use det.SetLegacyMode ( true );" << endl;
175 throw std::runtime_error (
"Failed consistency check in Detector::Smear()");
178 cerr <<
"Theta always needs to be smeared (at least with sigma=0)" << endl;
179 cerr <<
"For legacy smear scripts, use det.SetLegacyMode ( true );" << endl;
180 throw std::runtime_error (
"Failed consistency check in Detector::Smear()");
182 }
else if ( MomComponentsChanged + AngComponentsChanged != 3){
184 cerr <<
"Expected 0 (excluding phi, theta) or exactly 3 (excluding phi, theta) smeared momentum quantities." << endl;
185 cerr <<
"For legacy smear scripts, use det.SetLegacyMode ( true );" << endl;
186 cerr <<
"MomComponentsChanged = " << MomComponentsChanged << endl;
187 cerr << prt.
GetEta() << endl;
193 cerr <<
"AngComponentsChanged = " << AngComponentsChanged << endl;
194 cerr <<
" pid : " << prt.
Id() << endl;
195 throw std::runtime_error (
"Failed consistency check in Detector::Smear()");
205 cerr <<
"Smearing only one out of px, py is not supported. Please contact the authors." << endl;
206 cerr <<
"For legacy smear scripts, use det.SetLegacyMode ( true );" << endl;
207 throw std::runtime_error (
"Failed consistency check in Detector::Smear()");
212 cerr <<
"Smearing px, py, and phi is inconsistent" << endl;
213 cerr <<
"For legacy smear scripts, use det.SetLegacyMode ( true );" << endl;
214 throw std::runtime_error (
"Failed consistency check in Detector::Smear()");
217 cerr <<
"Smearing px, py, and pt is inconsistent" << endl;
218 cerr <<
"For legacy smear scripts, use det.SetLegacyMode ( true );" << endl;
219 throw std::runtime_error (
"Failed consistency check in Detector::Smear()");
224 prtOut->
SetPt( std::sqrt( std::pow( prtOut->
GetPx(),2) + std::pow( prtOut->
GetPy(),2) ) );
229 prtOut->
SetP( std::sqrt( std::pow( prtOut->
GetPt(),2) + std::pow( prtOut->
GetPz(),2) ) );
235 prtOut->
SetPz( std::sqrt( std::pow(prtOut->
GetP(), 2.) - std::pow(prtOut->
GetPt(), 2.)) );
241 assert ( fabs(std::tan(prtOut->
GetTheta())) > 1
e-8 );
243 prtOut->
SetP( std::sqrt( std::pow( prtOut->
GetPt(),2) + std::pow( prtOut->
GetPz(),2) ) );
252 cerr <<
"Momentum components are smeared, but neither phi nor px and py are." << endl;
253 cerr <<
"For legacy smear scripts, use det.SetLegacyMode ( true );" << endl;
254 throw std::runtime_error (
"Failed consistency check in Detector::Smear()");
270 prtOut->
SetPz( std::sqrt(std::pow(prtOut->
GetP(), 2) - std::pow(prtOut->
GetPt(), 2)));
275 prtOut->
SetP( std::sqrt(std::pow(prtOut->
GetPt(), 2) + std::pow(prtOut->
GetPz(), 2)));
281 assert ( fabs(std::tan(prtOut->
GetTheta())) > 1
e-8 );
283 prtOut->
SetP( std::sqrt(std::pow(prtOut->
GetPt(), 2) + std::pow(prtOut->
GetPz(), 2)));
287 prtOut->
SetPt( std::sqrt(std::pow(prtOut->
GetP(), 2) - std::pow(prtOut->
GetPz(), 2)));
293 prtOut->
SetP( std::sqrt( std::pow( prtOut->
GetPt(),2) + std::pow( prtOut->
GetPz(),2) ) );
312 std::vector<Smearer*> copies;
313 for ( std::vector<Smearer*>::const_iterator
it =
Devices.begin();
316 copies.push_back ( (*it)->Clone(
""));
330 std::cout <<
"Warning: Turning on legacy mode, i.e. deactivating consistency checks and momentum regularization in Smear(). Use only for legacy smear scripts from earlier versions (<~1.0.4)" << endl;