Softwares

Pedestal runs

The software resides in SVN, and can be obtained using:

   svn co svn+ssh://svn.cern.ch/reps/uttestbeamsoft

Data should be stored on eos. You can mount it on your local home directory on lxplus using:

   eosmount ~/eos 

Then, you should be able to drill down into subdirectories to see data (here, for the Oct 2014 TB data)

   cd ~/eos/lhcb/testbeam/ut/october_runs/data_oct

Use ped_000004_2907_1316.ali for pedestal calculation for July/August 2014 test beam!

These pedestals (10k events) are recorded with 225 V bias voltage and no beam, after grounding the box.

TbNtupleMaker.cpp

TbNtupleMaker reads an Alibava file and creates a ROOT file (same filename) with the following information:
  1. int NEvents, the number of events read from the header of the Alibava file;
  2. int RunType, the run type;
  3. std::vector<double> PedByGain, the pedestals calculated by the Alibava;
  4. std::vector<double> NoiseByGain, the noise calculated by the Alibava;
  5. std::vector<double> Gain, the gain calculated by the Alibava;
  6. TH1F histo_PedByGain;
  7. TH1F histo_NoiseByGain;
  8. TH1F histo_Gain;
  9. string Date = a->date(), the date read from the header of the Alibava file;
  10. std::vector<unsigned short> ADC, the raw ADC counts, one per event;
  11. double TDCTime, the TDC time (meaningful only in radioactive source runs), one per event;
  12. double Temp, the temperature, one per event;
  13. int n, a counter, one per event (starting from 1).
The ROOT file will be saved in a folder named RootFiles in the same folder where the Alibava file is (if no external path is provided) or in the folder specified by the external path.
Compile with:

make

Run with:

./TbNtupleMaker [Alibava file] [external path]

where:

- [Alibava file] is the complete path, including the folder and the filename, of the Alibava file one wants to process;
- [external path] is the optional external path where the RootFiles folder will be created.
For example:
./TbNtupleMaker /.../run_xxxxxx_xxxx_xxxx.ali</div>
or
./TbNtupleMaker /.../run_xxxxxx_xxxx_xxxx.ali /...</div>

ComputePedestals.C

ComputePedestals reads a ROOT file and creates a ROOT file with the following information:

  1. distribution of the ADC counts of each Beetle;
  2. distribution of the ADC counts of each Beetle channel (hADCx, with x = {0,...,255};
  3. mean of the above distribution as a function of the Beetle channel (the pedestal);
  4. RMS of the above distribution as a function of the Beetle channel (the noise);
  5. distribution of the pedestals of each Beetle;
  6. distribution of the noise of each Beetle.
It also creates a text file with three columns:
  1. Beetle channel, from 0 to 255;
  2. pedestal;
  3. noise.
Compile with:

g++ `root-config --glibs --cflags` ComputePedestals.C -o ComputePedestals

Run with:

./ComputePedestals [input ROOT file]

where [input ROOT file] is the complete path, including the folder and the filename, of the file one wants to process.

For example:

./ComputePedestals /.../run_xxxxxx_xxxx_xxxx.root
A folder named Analysis will be created in a fixed location and a ROOT file will be saved in there. A folder named Figures will be created inside the folder named Analysis, with some monitoring plots.

If needed, an external path can be specified, where the folder named Analysis will be created.

In this case, run with:

./ComputePedestals [input ROOT file] [external path]

ComputeCMN.C

ComputeCMN reads a ROOT file (containing the data to process) and a text file (containing the pedestals) and creates a ROOT file with the following information:

  1. all branches in the Header tree;
  2. all branches in the EventInfo tree, one per event;
  3. std::vector<double> Ped, the pedestals calculated by ComputePedestals;
  4. std::vector<double> ADCProcessed, one per event (result of pedestal+CMN subtraction);
  5. std::vector<double> ADCProcessed2, one per event (result of pedestal+CMN+step subtraction);
  6. double CMN1 (chip 1), one per event;
  7. double CMN2 (chip 2), one per event;
  8. std::vector<int> clusterSize;
  9. std::vector<double> clusterCharge;
  10. std::vector<double> clusterPosY;
  11. int nCluster.
It loops over events, creates the event-by-event histogram of the ADC counts as a function of the strip number (hADCBeetlexvsstrip) and distribution of the ADC counts (hADCBeetlex), ignores strips that may potentially contain a signal (by setting a threshold), calculates the average of the ADC counts, subtracts it to every strip, and creates again the event-by-event histogram of the ADC counts as a function of the strip number (hADCBeetlexvsstripCMNSub) and distribution of the ADC counts (hADCBeetlexCMNSub).

If there is no common mode noise, then the two versions will look the same.

It removes the steps event-by-event and creates the event-by-event histogram of the ADC counts as a function of the strip number (hADCBeetlexvsstripCMNStepSub).

It finds the clusters.

Compile with:

make
Run with:
./computeCMN -i [input ROOT file] -p [input text file (pedestals)] -e [external path]  [-r] 

where:

- [input ROOT file] is the complete path, including the folder and the filename, of the ROOT file one wants to process;

- [input text file (pedestals)] is the complete path, including the folder and the filename, of the text file one wants to get the pedestals from;

- [external path] is the optional external path where the output will be saved.

- [-r] is optional, and should be used for n-in-p sensor types that have reverse (negative) polarity

Monitoring.C

Monitoring creates some monitoring plots:

  1. cADCBeetle2StepSubImpact, the ADC counts distribution with pedestal and CMN subtraction compared to the ADC counts distribution with pedestal, CMN, and step subtraction;
  2. cADCBeetle2StepSubImpactLog, the same distributions described above, but with the log scale on the y axis;
  3. cclusterSizeBeetle2, the distribution of the cluster size;
  4. cnClusterBeetle2, the distribution of the number of clusters per event;
  5. cclusterPosYBeetle2, the distribution of the position of the clusters along y;
  6. cclusterPosYBeetle2Cut, the same distribution as above, but selecting only clusters with charge between 30 and 150 ADC counts;
  7. cclusterChargeBeetle2, the distribution of the cluster charge;
  8. cclusterChargeBeetle2TDC, the same distribution as above, but selecting different TDC time ranges.
Compile with: g++ `root-config --glibs --cflags` Monitoring.C -o Monitoring Run with: ./Monitoring [input ROOT file] [external path] where:
- [input ROOT file] is the complete path, including the folder and the filename, of the ROOT file one wants to process;
- [external path] is the optional external path where the output will be saved.

AddTrigTracks/combABwTP3

This code reads in the processed Alibava ROOT file (after ComputeCMN), a Kepler ROOT file, and produces a new Output file. The code takes the Trigger time and finds Tracks associated with each trigger using the timing information from the SPIDR boards. The output file is a replicate of the Alibava file, but includes a list of tracks associated with each Trigger in the Alibava file.

You need to know which Alibava ROOT file goes with which Kepler file. This can be found here

Compile with:

make

Run with (here, takes processed Alibava file=ComputeCMN-run_000021_0508_2358.root and Kepler tuple=~/eos/lhcb/testbeam/velo/timepix3/July2014/RootFiles/Run1302/Output/Run1302-tuple.root).

./combineABwTP3 -a ~/work/LHCb/TestBeam/Analysis/ComputeCMN-run_000021_0508_2358.root -t ~/eos/lhcb/testbeam/velo/timepix3/July2014/RootFiles/Run1302/Output/Run1302-tuple.root -o $outputdir/MyOutputFile.root -p planeNum

Above, note that some of the Kepler tuples have 8 times as many triggers written to them, one for each timepix plane. In this case, you need to choose one, or it will default to plane=0, which is probably OK.

The Kepler data from the telescope is stored on eos, so you will need to mount it using:

eosmount ~/eos
The output file should contain the same tree as the Alibava input file, with the additional entries for the associated Kepler tracks.

Codes in ``runall'' directory

The structure of this directory is:

  • all *cpp files are in the main directory and all the header files in the include directory. There is a Makefile.
  • the python_scripts directory have several scripts to run the stuff. Type ./example_code.py at the prompt to run the script.
  • change topdir in python_scripts/settings.py where you'll set your top working directory (eg. containing all the alibava files etc
  • ut_tb_oct14.xml contains all the run information extracted from the google docs page. This is created using make_xml_file.py and RunNumbers_2610_endofdatataking.txt
  • rename.py renames some of the alibava file that has *.ali extension missing
  • run_TbNtupleMaker.py generates the *.root files from the *.ali files
  • run_Move2BoardChipDir.py creates board-wise/chip-wise subdirectories and copies the root files to the appropriate location. All the info is taken from the .xml file.
  • run_CreateBoardWisePedestals.py creates the pedestal files and moves them to the appropriate board-wise directory
  • run_ComputeCMN.py runs the common-mode-noise subtraction. Needs a runfile (eg. run_000001_2210_0004) and a pedestal file. Gets the polarity info from the .xml file.

Codes in Analysis directory

  • Recommend to svn update to get Analysis/sblusk/October2014 as a starting point for the analysis code directory.
  • Make your own analysis directory, ~uttestbeamsoft/Analysis/myUserName/October2014/, and feel free to copy any code you want from the above area as a starting point.
  • Suggest also to copy the /dataLinks directory, and do a mkdir Output, mkdir Plots (for output ROOT files and plots)
  • Note: Eventually, we will have a common Analysis/default/October2014 directory, but for now, let's minimize clashes of analysis codes

  • In the directory Analysis/blusk/October2014/ you will find several C macros. There is a fairly complete description of what they are and how to use them in the README file.

Instructions for the Sbt package

The current version of the Sbt package is located at "[uttestbeamsoft_svn_folder]/Sbt_Milano/" . The main executable is named "TBmain", follow the instructions to compile and run:

  • Setup the ROOT version (tested with ROOT 5.34)
    source /afs/cern.ch/sw/lcg/external/gcc/4.8/x86_64-slc6/setup.sh 
    source /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.28/x86_64-slc6-gcc48-opt/root/bin/thisroot.sh 
  • Enter " [uttestbeamsoft_svn_folder]/Sbt_Milano/ " folder
  • Compile and execute TBmain
    make TBmain 
    ./TBmain [geom_config_file] [TP3_ROOT_file_(with_hits)] [Alibava_ROOT_file] [TP3_DUT_config_file] 
    As an alternative you can use
    ./run_Sbt.py
    ( Be sure to set the correct location for the ROOT input file folders and the list of the RUNs you want to process.)

Before running the Sbt package, you need to produce the proper [geom_config_file], [TP3_ROOT_file_(with_hits)], [Alibava_ROOT_file] and [TP3_DUT_config_file] files. The instructions to produce them are listed below:

  • Producing [geom_config_file] files from Kepler alignment files Enter "mpetruzz_scripts/Sbt_config_generator/" folder and mount the EOS folder
    cd [utttestbeamsoft_svn_folder]/mpetruzz_scripts/Sbt_config_generator/  
    eosmount eos  
    Copy the KEPLER alignment files to the "AlignmentFiles" and run the "Sbt_config_generator" python script. This will produce the [geom_config_file] files. In particular, the script reads the telescope roto-translation values from the Kepler alignment files and convert them accordingly to the Sbt reference system. For the DUT, a default zero-translation, zero-rotation is applied.
    ./copy_alignment_files.py 
    ./Sbt_config_generator.py 
    Copy the produced [geom_config_file] files to "Sbt_Milano/config/"
    cp -r [utttestbeamsoft_svn_folder]/mpetruzz_scripts/Sbt_config_generator/config  [utttestbeamsoft_svn_folder]/Sbt_Milano/config 

Examples of [geom_config_file] can be found in the "[uttestbeamsoft_svn_folder]/Sbt_Milano/config/" folder ( see "config_RUN_[RUN].dat" )
The [geom_config_file] contains:
- Dimensions (in cm) and type (single/double-sided strip, pixel, striplet) of the detectors
- List of the telescope and DUT planes (type, position and orientaton of each plane)
- Definition of planes to be used for the tracking
- Definitions of the clustering/tracking algorithm to be used (with relative parameters)
- Definition of the output filename and format to be used ( "data" or "MC"(for simulations) )

The [TP3_ROOT_file_(with_hits)] files must be produced from TP3 RAW files using KEPLER. A little mod to the KEPLER routine has been introduced to produce [TP3_ROOT_file_(with_hits)] files containing the trigger times and the time-ordered hits (one tree for each detector) associated to the triggers. The output ROOT files contain also the tracks reconstructed with KEPLER, associated to the triggers ( for debugging purposes, or analysis without Sbt ).
The instruction to produce the files are listed below:

  • Download KEPLER according to the "Tpx3TestbeamSoftware" TWiki page, available at "https://lbtwiki.cern.ch/bin/view/VELO/Tpx3TestbeamSoftware"
  • Substitute the "~/cmtuser/KEPLER/KEPLER_HEAD/Tb/TbIO/src/TbTupleWriter.cpp" and "/cmtuser/KEPLER/KEPLER_HEAD/Tb/TbIO/src/TbTupleWriter.h" with the modified ones, available at "[utttestbeamsoft_svn_folder]/mpetruzz_scripts/Kepler_mod/Tb/TbIO/src/"
  • Compile KEPLER
  • Produce the KEPLER configuration files for the runs. The script produces the configuration files with the proper settings for the Oct2014 runs.
    cd [utttestbeamsoft_svn_folder]/mpetruzz_scripts/Kepler_config_generator/ 
    ./Kepler_config_generator.py 
    .
  • Setup the KEPLER environment and run.
    SetupProject Kepler 
    gaudirun.py config/tuple_[RUN].py 
    The KEPLER will produce the [TP3_ROOT_file_(with_hits)] output file for the corresponding [RUN]

Examples of [TP3_DUT_config_file] can be found in the "[uttestbeamsoft_svn_folder]/Sbt_Milano/config/" folder ( see "OctParms_chip1_time1.dat" and similar ).

Additional information

For information about October/November 2014 test beam offline analysis go to TbOfflineAnalysisOctNov2014.

-- FedericaLionetto - 30 Jul 2014

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatext README r2 r1 manage 5.6 K 2014-12-12 - 00:11 StevenBlusk  
Edit | Attach | Watch | Print version | History: r18 < r17 < r16 < r15 < r14 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r18 - 2015-04-22 - MarcoPetruzzo
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback