Event Processing - detector_driver

This page describes the aspects of the detector_driver.cpp file used for rawevent processing which remain consistent between experiments and includes six different functions

Initialization

As mentioned in the pixie_std.cpp initialization section the detector_driver initialization routine (detector_driver::init()) is called with the empty rawevent and a vector of detector types that have been identified from the reading if the map.txt. A local copy of the detectors used in the current analysis is kept in the detector driver using the following code:
  //file detector_driver.cpp - init(rawevent &revt, vector<string> &used)
  set_used_detectors(used);

Using this vector the detector_driver creates a detector_summary for each detector type and places it into the map of detector_summaries det_sum using the following code:

  //file detector_driver.cpp - init(rawevent &revt, vector<string> &used)
  detector_summary ds;
  for(unsigned int i =0; i<used_detectors.size(); i++){
     ds.zerodet_summary();
     string name = used_detectors[i];
     det_sum.insert(make_pair(name,ds));
  }
This map is then inserted into the rawevent class. The detector and analysis specific objects are initialized through their respective routines.

Next, the variables temppoint and temppointvalid are constructed for use in the experiment specific portion of the detector_driver. Into the vector tempoint is placed a pointer by reference to a detector_summary for each detector_type and a new element is added to the temppointvalid vector with a value of 0 using the following code:

    temppoint.push_back( &((revt.det_sum["dssd_front"])) );
    temppointvalid.push_back(0);
    temppoint.push_back( &((revt.det_sum["dssd_back"])) );
    temppointvalid.push_back(0);
    temppoint.push_back( &((revt.det_sum["idssd_front"])) );
    temppointvalid.push_back(0);
    temppoint.push_back( &((revt.det_sum["position"])) );
    temppointvalid.push_back(0);
    temppoint.push_back( &((revt.det_sum["timeclass"])) );
    temppointvalid.push_back(0);
    temppoint.push_back( &((revt.det_sum["ge"])) );
    temppointvalid.push_back(0);
    temppoint.push_back( &((revt.det_sum["si"])) );
    temppointvalid.push_back(0);
    temppoint.push_back( &((revt.det_sum["scint"])) );
    temppointvalid.push_back(0);
    temppoint.push_back( &((revt.det_sum["mcp"])) );
    temppointvalid.push_back(0);
Using the proper tempoint element for retrieving information from a specific detector_summary is much faster than searching the map for the correct entry. For example, it is much faster to retrieve the mcp multiplicity using the command
  temppoint[8]->get_mult()
than searching the map for the mcp entry as follows
  revt.det_sum["mcp"].get_mult();
This greatly increases execution speed in those situations (the experiment specific processing) where you known what detector type needs to be queried. However, if a detector type is not used in the analysis (for example the idssd_front which is used only in NSCL fragmentation experiments) the code fragment above will place an invalid reference into the temppoint vector above. Thus it is necessary to check the temppointvalid element has a value of 1 to make sure that the temppoint vector has a valid reference. The temppointvalid elements are set to one only for those detector types which are used in the analysis with the following statements:
  iud=used_detectors.begin();
  while(iud!=used_detectors.end()){
     if(*iud == "dssd_front") temppointvalid[0] = 1;
     if(*iud == "dssd_back") temppointvalid[1] = 1;
     if(*iud == "idssd_front") temppointvalid[2] = 1;
     if(*iud == "position") temppointvalid[3] = 1;
     if(*iud == "timeclass") temppointvalid[4] = 1;
     if(*iud == "ge") temppointvalid[5] = 1;
     if(*iud == "si") temppointvalid[6] = 1;
     if(*iud == "scint") temppointvalid[7] = 1;
     if(*iud == "mcp") temppointvalid[8] = 1;
     iud++;
  }

readcal

The calibrations are read in during the detector driver initialization (detector_driver::readcal()) from the cal.txt file. Please see cal.txt for detailed information on the cal.txt file

For each line in the cal.txt file the calibration is read into the calibration vector. After all calibration lines are read in the map.txt file is reopened and the calibration vector is reordered to match the order defined in map.txt. If a channel in the map.txt does not exist in the cal.txt the program will issues an error and terminate. All channels not set to "ignore" must have a valid calibration. The information from the map.txt and cal.txt are combined and output is printed to the screen for visual inspection.

process_event

The process_event() function receives a rawevent object passed to it from Scan_List() and processes it. The analysis loops over all channels contained within the rawevent and threshold checks and calibrates the energy, plots both the raw and calibrated energies (if the appropriate damm spectra have been created), and performs a trace analysis if a trace is present.

threshandcal

The function threshandcal() receives a pointer to the current channel and its associated detector_summary. The channel is calibrated using the element at "module number * 16 + channel number" in the calibration vector. After calibration the detector_summary for this detector type is updated and the location of this channel in the event is added to the locations vector in the detector_summary. The locations vector than then be retrieved later in the analysis to only inspect channels associated with a specific detector type.

trace

If a trace is included with the channel object then the trace analysis is invoked through analyzetrace()

plotraw

The raw energy from the channel is plotted into the appropriate damm spectra as long as it was created in the drrsub.f file.

plotcal

The calibrated energy from the channel is plotted into the appropriate damm spectrum if it was created in the drrsub.f file

Warning:
There is no default calibration

Provide a calibration line for every channel not set to "ignore" in the map.txt file. Failure to do so will cause the program to terminate so the user can fix the problem.


Generated on Wed May 14 10:07:06 2008 for pixie16 by  doxygen 1.5.5