Template processor source code

Return to the main readme

One must realize that the fullness of the source code will not be contained within this readme file, bur rather the portions that we seek to study. Concrete examples to be studied are included as the probTop*.cpp and probTop*.hpp series of processors which are the signal channels pertinent to top analysis.

probTemplate::probTemplate(const char *name)
        : probProcessor(name)
{ }

//EffInfo objects are defined here
void probTemplate::defineEffInfo(std::map< std::string, eff_utils::EffInfo >∧ effInfo)
{

    ////////////////////////////////////////////////////////////
    ///////////////////////Code goes here///////////////////////
    
    //We create an EffInfo request, then shove it in an object
    //with a name of our choosing to be used later on.
    
    effInfo["Template"].EffName("Template");
    effInfo["Template"].EffType("Binned");
    effInfo["Template"].EffVersion(2);

    effInfo["Template"].ObjQuality("LOOSE");
    effInfo["Template"].ObjType("EM");
    effInfo["Template"].ObjVersion(0);

    std::vector< std::string > vars;
    vars.push_back("pt");
  
    effInfo["Template"].EffVarNames( vars );

    ////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////

}

////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//The actual probability calculations are defined here and after calcProb
double probTemplate::calcProb(std::string version)
{
    
    //This sets up the channel name and is important to set!
    _channel = "Template";
    
    double probability = P_Template(version);

    return probability;

}

//This is where you shall be placing your own combinatorics. You'll
//want to read the instructions in doc/readme.html
double probTemplate::P_Template(std::string version)
{
    double probability = 1.0;
    
    double stat = 0.0;

    //Temporary for the Template.
    //This sets up the effInfo version object.

    //This grabs the probability of this template example, which doesn't
    //actually exist!
//    probObject("Template")->getProbability(MU[iobj], stat)

    //Now we just return 1.0    
    return probability;
}

ClassImp(probTemplate)

One should note, that there are a number of objects that are passed into the event, and passed out of the event. The ones that will be of interest are:

eventWeight, eventWeightSigma and event.put are located in the base class probProcessor.

All of these objects are crucial to ones calculations and one should now refer to the method calcProb(int version). Specifically the methods after the lines of

////////////////////////////////////////////////////////////

Note: This is the only portion one should be editing. Editing any other portions will cause problems if one is not well versed in the code.

Also, there is a template_combine processor, which is a template processor for the final combination processor. This contains a change in the eventWeightSigma code which overrides the base class code. You do not have to worry about touching this method at all. Just look to the examples.


Let us delve into the call to calcProb(version). This piece of code has several crucial portions:

probObject() = new objectProbabilities(mSigma) is called outside of ths code This creates a probability object for you which you can use as such. Within the brackets, one will be placing the name of the EffInfo object created earlier.

Where the objectProbabilities class has methods to retrieve turn-on curve efficiencies for an object with a certain Pt, Eta and Phi. One must know ones triggers before hand, but this should be a given. Our constructor passes into the event the efficiency turn-on curve fits, the systematics, and any +1, -1 sigma calculationes one wishes to calculate.

_channel = "Template";

This lets the framework know the name of ones processor. When one changes the name of this template processor to reflect the triggers/signal channel one is interested in, one should also change this string. Examples are of course shown in the processors that come with the class.

double probability = P_template(version);

This is the main call to ones methods. In the template, this calls an empty method which returns a dummy probability, but one shall be filling that method and hopefully splitting ones methods into level 1, level 2 and level 3 probabilities which one can then multiply out at the end. (See muw_w_l2m3_trk10 as an example)

return probability;

Finally, this method returns the probability that ones combinatorics have delivered back to this point. What exactly happens to ones probabilities after this point? We shall look at the steps together.

  1. The event weight is passed into the next event in a map<string, double> with the string name = _channel (For example, "TopDiem").
  2. The event weight reaches the next processor which may or may not modify it further. One may have a second processor, say TopElectron, and a third processor, say TopCombine, which would combine the event weights passed down by TopDiem and TopElectron.

    It's easy to see how one could split up ones processors into a level 1, level 2 and a level 3 processor which would use a 4th processor to combine the probabilities of the first 3. The framework is flexible enough to accomodate varied needs.
    One might also have two of the same probability processors which differ only in the combinatorics in order to develope new triggers or to test ones combinatorics for accuracy. The availability of multiple outputs is handy in these cases.

  3. The event weights reach the output processor, and one should refer to the main readme for further information on this topic.


One should now be familiarized with the flow of the probability processor, but what happens if one chooses to place a ".sigma: true" in ones CAFe configuration file? Ones combinatorics are called numerous times as shown below;

For +1 sigma, add all the returned probabilities in quadrature, similarly with the -1 sigma probabilities. This is how the +1 and -1 sigma variations are retrieved. These are passed into the event with the following std::string variables:

For example, "TopDiem Sigmas: -1". As one may have surmised, changing the _channel variable to a descriptive one is preferential.

Of course, one must change the names of the processor and methods (from probTemplate) in order to create a new processor as per the instructions.

Return to the main readme