KaliVeda
Toolkit for HIC analysis
KVDataPatch_CorrectEtalonModuleIDCode.cpp
1 //Created by KVClassFactory on Thu Jan 30 15:16:45 2014
2 //Author: John Frankland,,,
3 
4 #include "KVDataPatch_CorrectEtalonModuleIDCode.h"
5 #include <KVINDRAReconNuc.h>
6 #include <KVINDRAReconEvent.h>
7 #include "KVINDRA.h"
8 #include "TClass.h"
9 
11 
12 
13 
17 {
18  // Default constructor
19  SetName(ClassName());
20  SetTitle(Class()->GetTitle());
21 }
22 
23 
24 
27 
29 {
30  // Destructor
31 }
32 
33 
34 
38 
39 Bool_t KVDataPatch_CorrectEtalonModuleIDCode::IsRequired(TString dataset, TString datatype, Int_t, TString dataseries, Int_t datareleasenumber, const TList*)
40 {
41  // Patch is applied to all runs of INDRA 5th campaign 'root' or 'ident' data
42  // written with KaliVeda version 1.8.11
43 
44  return (dataset == "INDRA_camp5"
45  && (datatype == "root" || datatype == "ident")
46  && dataseries == "1.8" && datareleasenumber == 11);
47 }
48 
49 
50 
53 
55 {
56  // Just used to set pointer to current event
58 }
59 
60 
61 
70 
72 {
73  // Patch is applied to all identified particles stopping in the CsI member of
74  // an etalon module which have general ID code 5.
75  // If the CsI identification is available and was succesful, then either
76  // (1) for gammas we set the correct ID code and set the energy = 0
77  // (2) for charged particles we correct the ID code and the energy
78  // which is probably overestimated (due to taking into account the
79  // Si75/SiLi in the calibration when in fact they were not hit)
80 
82  if (N->IsIdentified() && N->GetRingNumber() > 9 && N->StoppedInCsI() && (N->GetSiLi() || N->GetSi75())
83  && N->GetCodes().TestIDCode(KVINDRACodeMask::kIDCode5)) {
84  KVIdentificationResult* idr = N->GetIdentificationResult(1);
85  if (idr->IDattempted && idr->IsType("CSI_R_L") && idr->IDOK) {
86  if (idr->IDcode == KVINDRACodeMask::kIDCode0) {
87  // gamma
88  // just set general IDcode gamma and set energy = 0
89  N->SetIdentification(idr, N->GetIdentifyingTelescope());
90  N->SetEnergy(0.);
91  N->GetParameters()->SetValue("KVDataPatch_CorrectEtalonModuleIDCode", "correction applied");
92  }
93  else {
94  // charged particle
95  // needs re-identifying and re-calibrating
97  Bool_t ok = N->CoherencyChIoCsI(ID);
98  if (ok) {
99  N->SetIdentification(&ID, N->GetIdentifyingTelescope());
100  N->Calibrate();
101  N->GetParameters()->SetValue("KVDataPatch_CorrectEtalonModuleIDCode", "correction applied");
102  }
103  else {
104  Warning("ApplyToParticle", "Rustine failed for the following particle:");
105  N->GetParameters()->SetValue("KVDataPatch_CorrectEtalonModuleIDCode", "correction failed");
106  N->Print();
107  }
108  }
109  // update particle's 'OK' status
110  gMultiDetArray->AcceptParticleForAnalysis(N);
111  }
112  }
113 }
114 
115 
116 
118 
120 {
121  std::cout << "Correct bad attribution of IDCode & calibration of particles stopping" << std::endl;
122  std::cout << "in CsI detectors behind etalon telescopes." << std::endl;
123  std::cout << "Gammas (IDcode=0) and light charged particles (IDcode=2) were given" << std::endl;
124  std::cout << "IDcode=5 due to a bug in v1.8.11 (lp:bug#1271634)" << std::endl << std::endl;
125  std::cout << "The status of the correction can be obtained from parameter" << std::endl;
126  std::cout << "KVDataPatch_CorrectEtalonModuleIDCode: " << std::endl;
127  std::cout << " ='correction applied' or 'correction failed'" << std::endl;
128 }
129 
130 
131 
int Int_t
#define e(i)
bool Bool_t
#define N
virtual Bool_t IsType(const Char_t *typ) const
Definition: KVBase.h:185
Patch for correcting bad id-code & calibration for particles stopping in CsI member of etalon modules...
void ApplyToEvent(KVReconstructedEvent *e)
Just used to set pointer to current event.
virtual Bool_t IsRequired(TString dataset, TString datatype, Int_t runnumber, TString dataseries, Int_t datareleasenumber, const TList *streamerinfolist)
KVINDRAReconEvent * fEvent
pointer to current event
Event reconstructed from energy losses in INDRA multidetector.
Nuclei reconstructed from data measured in the INDRA array.
Full result of one attempted particle identification.
Bool_t IDattempted
=kTRUE if identification was attempted
Bool_t IDOK
general quality of identification, =kTRUE if acceptable identification made
Int_t IDcode
a general identification code for this type of identification
virtual void AcceptParticleForAnalysis(KVReconstructedNucleus *) const
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
Nuclei reconstructed from data measured by a detector array .
virtual void Warning(const char *method, const char *msgfmt,...) const
RooCmdArg ClassName(const char *name)
gr SetName("gr")
const Int_t n
const char * Class
ClassImp(TPyArg)