Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /irt/delphes/scripts/evaluator.C was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 
0002 // 
0003 // ! Make sure libDELPHES.so is in LD_LIBRARY_PATH
0004 //
0005 // cd delphes/scripts
0006 //
0007 // root -l 'evaluator.C("<delphes-file.root>")'
0008 //
0009 // root -l 'evaluator.C("e_pi_pid.root")'
0010 // 
0011 
0012 void evaluator(const char *fname)
0013 {
0014   auto ff = new TFile(fname);
0015   auto dconfig = dynamic_cast<DelphesConfigRICH*>(ff->Get("DelphesConfigRICH"));
0016   ff->Close();
0017 
0018   {
0019     // Use the same momentum, not to overcomplicate logic;
0020     TVector3 p(0.0, 0.4, -3.0);
0021     printf("%f\n", p.Eta());
0022 
0023     // Electron hypothesis;
0024     auto electron = dconfig->GetMassHypothesis(11), pion = dconfig->GetMassHypothesis(211);
0025 
0026     // In gaussian sigma units "to the left" (towards the pion peak location); 
0027     double cutoff = -1.0;
0028     unsigned inefficiency = 0, misidentification = 0, contamination = 0;
0029 
0030     // Generate few random electron & pion events, in a 50:50 proportion;
0031     for(unsigned iq=0; iq<50; iq++) {
0032       auto truth = iq%2 ? electron : pion;
0033 
0034       // Using built-in configuration (average Cherenkov angle <theta> for this
0035       // particle hypothesis defined by momentum and encoded medium refractive index, 
0036       // as well as expected Cherenkov angle smearing for this combination of {pdg,p,eta})
0037       // simulate a "measured" Cherenkov angle for this event using rndm.Gaus() call;
0038       double theta = dconfig->GenerateMeasurement(truth->PdgCode(), p);
0039 
0040       // Check which particle hypothesis wins (gives smaller chi^2 for this 'theta');
0041       auto best = dconfig->FindBestHypothesis(p, theta);
0042 
0043       char signature = ' ';
0044       // Evaluate the outcome;
0045       if (truth == electron) {
0046     // Electron identified as pion; so be it;
0047     if (best != electron) {
0048       misidentification++;
0049       signature = 'm';
0050     } //if
0051 
0052     // Electron measured "too close to pion" and rejected; sigh!;
0053     if (best == electron && electron->GetMeasurementOffset() < cutoff) {
0054       inefficiency++;
0055       signature = 'i';
0056     } //if
0057       } else {
0058     // Pion identified as electron, and accepted as such; bad!;
0059     if (best == electron && electron->GetMeasurementOffset() > cutoff) {
0060       contamination++;
0061       signature = 'c';
0062     } //if
0063       } //if
0064 
0065       printf("%3d %3d -> %7.2f [mrad] (%3d %c, %7.2f [sigma])\n", iq, truth->PdgCode(), theta,
0066          best->PdgCode(), signature, electron->GetMeasurementOffset());
0067     } //for iq
0068   }
0069 } // evaluator()