PamCut: CollectionActions/ChargeHistosAction/ChargeHistosAction.cpp Source File

- Main Page
- Classes
- Files

- File List
- File Members

# CollectionActions/ChargeHistosAction/ChargeHistosAction.cpp

Go to the documentation of this file.

    00001 /*
    00002  * ChargeHistosAction.cpp
    00003  *
    00004  *  Created on: 17-mag-2009
    00005  *      Author: Nicola Mori
    00006  */
    00007
    00010 #include "ChargeHistosAction.h"
    00011
    00012 ChargeHistosAction::ChargeHistosAction(const char *actionName, TString outFileName) :
    00013   CollectionAction(actionName),
    00014 #ifndef NO_TOFNUCLEI
    00015   _tofNuclei(NULL),
    00016   _chargeS11("chargeS11", "Charge S11", 100, 0., 4.),
    00017   _chargeS12("chargeS12", "Charge S12", 100, 0., 4.),
    00018   _chargeS21("chargeS21", "Charge S21", 100, 0., 4.),
    00019   _chargeS22("chargeS22", "Charge S22", 100, 0., 4.),
    00020   _chargeS31("chargeS31", "Charge S31", 100, 0., 4.),
    00021   _chargeS32("chargeS32", "Charge S32", 100, 0., 4.),
    00022   _chCorrS11S12("chCorrS11S12", "Z(S11) vs Z(s12)", 100, 0., 4., 100, 0., 4.),
    00023   _chCorrS11S21("chCorrS11S21", "Z(S11) vs Z(s21)", 100, 0., 4., 100, 0., 4.),
    00024   _chCorrS11S22("chCorrS11S22", "Z(S11) vs Z(s22)", 100, 0., 4., 100, 0., 4.),
    00025   _chCorrS11S31("chCorrS11S31", "Z(S11) vs Z(s31)", 100, 0., 4., 100, 0., 4.),
    00026   _chCorrS11S32("chCorrS11S32", "Z(S11) vs Z(s32)", 100, 0., 4., 100, 0., 4.),
    00027   _chCorrS12S21("chCorrS12S21", "Z(S12) vs Z(s21)", 100, 0., 4., 100, 0., 4.),
    00028   _chCorrS12S22("chCorrS12S22", "Z(S12) vs Z(s22)", 100, 0., 4., 100, 0., 4.),
    00029   _chCorrS12S31("chCorrS12S31", "Z(S12) vs Z(s31)", 100, 0., 4., 100, 0., 4.),
    00030   _chCorrS12S32("chCorrS12S32", "Z(S12) vs Z(s32)", 100, 0., 4., 100, 0., 4.),
    00031   _chCorrS21S22("chCorrS21S22", "Z(S21) vs Z(s22)", 100, 0., 4., 100, 0., 4.),
    00032   _chCorrS21S31("chCorrS21S31", "Z(S21) vs Z(s31)", 100, 0., 4., 100, 0., 4.),
    00033   _chCorrS21S32("chCorr212S32", "Z(S21) vs Z(s32)", 100, 0., 4., 100, 0., 4.),
    00034   _chCorrS22S31("chCorrS22S31", "Z(S22) vs Z(s31)", 100, 0., 4., 100, 0., 4.),
    00035   _chCorrS22S32("chCorrS22S32", "Z(S22) vs Z(s32)", 100, 0., 4., 100, 0., 4.),
    00036   _chCorrS31S32("chCorrS31S32", "Z(S31) vs Z(s32)", 100, 0., 4., 100, 0., 4.),
    00037 #endif
    00038 #ifndef NO_CALONUCLEI
    00039   _caloNuclei(NULL),
    00040   _chargeCalo("chargeCalo", "Charge Calo", 100, 0., 4.),
    00041 #endif
    00042 #ifndef NO_TRKNUCLEI
    00043   _trkNuclei(NULL),
    00044   _chargeTrk("chargeTrk", "Charge Trk", 100, 0., 4.),
    00045 #endif
    00046   _outFileName(outFileName) {
    00047 }
    00048
    00049
    00050 ChargeHistosAction::~ChargeHistosAction(){
    00051 #ifndef NO_TOFNUCLEI
    00052   delete _tofNuclei;
    00053   _tofNuclei = NULL;
    00054 #endif
    00055
    00056 #ifndef NO_CALONUCLEI
    00057   delete _caloNuclei;
    00058   _caloNuclei = NULL;
    00059 #endif
    00060
    00061 #ifndef NO_TRKNUCLEI
    00062   delete _trkNuclei;
    00063   _trkNuclei = NULL;
    00064 #endif
    00065 }
    00066
    00067
    00068
    00069 void ChargeHistosAction::OnGood(PamLevel2 *event) {
    00070
    00071 #ifndef NO_TOFNUCLEI
    00072   if (_tofNuclei == NULL)
    00073     _tofNuclei = new ToFNuclei(event);
    00074
    00075   Float_t *charge = _tofNuclei->Get_Charge_ToF_std_layer();
    00076
    00077   _chargeS11.Fill(charge[0]);
    00078   _chargeS12.Fill(charge[1]);
    00079   _chargeS21.Fill(charge[2]);
    00080   _chargeS22.Fill(charge[3]);
    00081   _chargeS31.Fill(charge[4]);
    00082   _chargeS32.Fill(charge[5]);
    00083
    00084   _chCorrS11S12.Fill(charge[1], charge[0]);
    00085   _chCorrS11S21.Fill(charge[2], charge[0]);
    00086   _chCorrS11S22.Fill(charge[3], charge[0]);
    00087   _chCorrS11S31.Fill(charge[4], charge[0]);
    00088   _chCorrS11S32.Fill(charge[5], charge[0]);
    00089   _chCorrS12S21.Fill(charge[2], charge[1]);
    00090   _chCorrS12S22.Fill(charge[3], charge[1]);
    00091   _chCorrS12S31.Fill(charge[4], charge[1]);
    00092   _chCorrS12S32.Fill(charge[5], charge[1]);
    00093   _chCorrS21S22.Fill(charge[3], charge[2]);
    00094   _chCorrS21S31.Fill(charge[4], charge[2]);
    00095   _chCorrS21S32.Fill(charge[5], charge[2]);
    00096   _chCorrS22S31.Fill(charge[4], charge[3]);
    00097   _chCorrS22S32.Fill(charge[5], charge[3]);
    00098   _chCorrS31S32.Fill(charge[5], charge[4]);
    00099 #endif
    00100
    00101 #ifndef NO_CALONUCLEI
    00102   if (_caloNuclei == NULL)
    00103     _caloNuclei = new CaloNuclei(event);
    00104   _chargeCalo.Fill(_caloNuclei->Get_charge_siegen1());
    00105 #endif
    00106
    00107 #ifndef NO_TRKNUCLEI
    00108   if (_trkNuclei == NULL)
    00109     _trkNuclei = new TrkNuclei();
    00110   _trkNuclei->Set(event->GetTrack(0)->GetTrkTrack());
    00111   _chargeTrk.Fill(_trkNuclei->GetZ_Rigidity());
    00112 #endif
    00113
    00114 }
    00115
    00116 void ChargeHistosAction::Finalize() {
    00117   TFile outFile(_outFileName, "RECREATE");
    00118   outFile.cd();
    00119
    00120 #ifndef NO_TOFNUCLEI
    00121   _chargeS11.Write();
    00122   _chargeS12.Write();
    00123   _chargeS21.Write();
    00124   _chargeS22.Write();
    00125   _chargeS31.Write();
    00126   _chargeS32.Write();
    00127
    00128   _chCorrS11S12.Write();
    00129   _chCorrS11S21.Write();
    00130   _chCorrS11S22.Write();
    00131   _chCorrS11S31.Write();
    00132   _chCorrS11S32.Write();
    00133   _chCorrS12S21.Write();
    00134   _chCorrS12S22.Write();
    00135   _chCorrS12S31.Write();
    00136   _chCorrS12S32.Write();
    00137   _chCorrS21S22.Write();
    00138   _chCorrS21S31.Write();
    00139   _chCorrS21S32.Write();
    00140   _chCorrS22S31.Write();
    00141   _chCorrS22S32.Write();
    00142   _chCorrS31S32.Write();
    00143 #endif
    00144
    00145 #ifndef NO_CALONUCLEI
    00146   _chargeCalo.Write();
    00147 #endif
    00148
    00149 #ifndef NO_TRKNUCLEI
    00150   _chargeTrk.Write();
    00151 #endif
    00152
    00153   outFile.Close();
    00154
    00155 }