AliPhysics  9b6b435 (9b6b435)
AliCutHandlerPCM.cxx
Go to the documentation of this file.
1 #include "AliCutHandlerPCM.h"
2 
3 using namespace std;
4 
6 ClassImp(AliCutHandlerPCM)
8 
9 //________________________________________________________________________
11 fMode(0),
12 fNCuts(0),
13 fNMaxCuts(10),
14 fValidCuts(kTRUE),
15 fValidCutsEvent(kTRUE),
16 fValidCutsPCM(kTRUE),
17 fValidCutsCalo(kTRUE),
18 fValidCutsMergedCalo(kTRUE),
19 fValidCutsMeson(kTRUE),
20 fValidCutsElectron(kTRUE),
21 fValidCutsNDM(kTRUE),
22 fValidCutsChargedPion(kTRUE),
23 fEventCutArray(0),
24 fPhotonCutArray(0),
25 fMesonCutArray(0),
26 fClusterCutArray(0),
27 fMergedClusterCutArray(0),
28 fElectronCutArray(0),
29 fNeutralDecayMesonCutArray(0),
30 fChargedPionCutArray(0)
31 {
32  fNCuts = 0;
33  fNMaxCuts = 10;
34  fEventCutArray = new TString[fNMaxCuts];
35  fPhotonCutArray = new TString[fNMaxCuts];
36  fMesonCutArray = new TString[fNMaxCuts];
37  fClusterCutArray = new TString[fNMaxCuts];
38  fMergedClusterCutArray = new TString[fNMaxCuts];
39  fElectronCutArray = new TString[fNMaxCuts];
40  fNeutralDecayMesonCutArray = new TString[fNMaxCuts];
41  fChargedPionCutArray = new TString[fNMaxCuts];
42  for(Int_t i=0; i<fNMaxCuts; i++) {
43  fEventCutArray[i] = "";
44  fPhotonCutArray[i] = "";
45  fMesonCutArray[i] = "";
46  fClusterCutArray[i] = "";
47  fMergedClusterCutArray[i] = "";
48  fElectronCutArray[i] = "";
49  fNeutralDecayMesonCutArray[i] = "";
50  fChargedPionCutArray[i] = "";
51  }
52 }
53 
54 //________________________________________________________________________
56  fMode(0),
57  fNCuts(0),
58  fNMaxCuts(1),
59  fValidCuts(kTRUE),
60  fValidCutsEvent(kTRUE),
61  fValidCutsPCM(kTRUE),
62  fValidCutsCalo(kTRUE),
63  fValidCutsMergedCalo(kTRUE),
64  fValidCutsMeson(kTRUE),
65  fValidCutsElectron(kTRUE),
66  fValidCutsNDM(kTRUE),
67  fValidCutsChargedPion(kTRUE),
68  fEventCutArray(0),
69  fPhotonCutArray(0),
70  fMesonCutArray(0),
71  fClusterCutArray(0),
72  fMergedClusterCutArray(0),
73  fElectronCutArray(0),
74  fNeutralDecayMesonCutArray(0),
75  fChargedPionCutArray(0)
76 {
77  fNCuts = 0;
78  fNMaxCuts = nMax;
87 
88  for(Int_t i=0; i<fNMaxCuts; i++) {
89  fEventCutArray[i] = "";
90  fPhotonCutArray[i] = "";
91  fMesonCutArray[i] = "";
92  fClusterCutArray[i] = "";
93  fMergedClusterCutArray[i] = "";
94  fElectronCutArray[i] = "";
96  fChargedPionCutArray[i] = "";
97  }
98 }
99 
100 void AliCutHandlerPCM::AddCutPCM(TString eventCut, TString photonCut, TString mesonCut){
101  if(fNCuts>=fNMaxCuts) {
102  cout << "ERROR in AliCutHandlerPCM: Exceeded maximum number of cuts!" << endl;
103  fValidCuts = false;
104  return;
105  }
106  if( eventCut.Length()!=8 || photonCut.Length()!=26 || mesonCut.Length()!=16 ) {
107  cout << "ERROR in AliCutHandlerPCM: Incorrect length of cut string!" << endl;
108  fValidCutsEvent = kFALSE;
109  fValidCutsPCM = kFALSE;
110  fValidCutsMeson = kFALSE;
111  fValidCuts = false;
112  return;
113  }
114  fMode = 0;
115  fEventCutArray[fNCuts] = eventCut;
116  fPhotonCutArray[fNCuts] = photonCut;
117  fMesonCutArray[fNCuts] = mesonCut;
118  fNCuts++;
119  return;
120 }
121 
122 void AliCutHandlerPCM::AddCutPCM(TString eventCut, TString photonCut, TString mesonCut, TString clusterCut){
123  if(fNCuts>=fNMaxCuts) {
124  cout << "ERROR in AliCutHandlerPCM: Exceeded maximum number of cuts!" << endl;
125  fValidCuts = false;
126  return;
127  }
128  if( eventCut.Length()!=8 || photonCut.Length()!=26 || mesonCut.Length()!=16 || clusterCut.Length()!=19 ) {
129  cout << "ERROR in AliCutHandlerPCM: Incorrect length of cut string!" << endl;
130  fValidCutsEvent = kFALSE;
131  fValidCutsPCM = kFALSE;
132  fValidCutsCalo = kFALSE;
133  fValidCutsMeson = kFALSE;
134  fValidCuts = false;
135  return;
136  }
137  fMode = 0;
138  fEventCutArray[fNCuts] = eventCut;
139  fPhotonCutArray[fNCuts] = photonCut;
140  fMesonCutArray[fNCuts] = mesonCut;
141  fClusterCutArray[fNCuts] = clusterCut;
142  fNCuts++;
143  return;
144 }
145 
146 void AliCutHandlerPCM::AddCutCalo(TString eventCut, TString clusterCut, TString mesonCut){
147  if(fNCuts>=fNMaxCuts) {
148  cout << "ERROR in AliCutHandlerPCM: Exceeded maximum number of cuts!" << endl;
149  fValidCuts = false;
150  return;
151  }
152  if( eventCut.Length()!=8 || clusterCut.Length()!=19 || mesonCut.Length()!=16 ) {
153  cout << "ERROR in AliCutHandlerPCM: Incorrect length of cut string!" << endl;
154  fValidCutsEvent = kFALSE;
155  fValidCutsCalo = kFALSE;
156  fValidCutsMeson = kFALSE;
157  fValidCuts = false;
158  return;
159  }
160  fMode = 2;
161  fEventCutArray[fNCuts] = eventCut;
162  fMesonCutArray[fNCuts] = mesonCut;
163  fClusterCutArray[fNCuts] = clusterCut;
164  fNCuts++;
165  return;
166 }
167 
168 void AliCutHandlerPCM::AddCutMergedCalo(TString eventCut, TString clusterCut, TString clusterMergedCut, TString mesonCut){
169  if(fNCuts>=fNMaxCuts) {
170  cout << "ERROR in AliCutHandlerPCM: Exceeded maximum number of cuts!" << endl;
171  fValidCuts = false;
172  return;
173  }
174  if( eventCut.Length()!=8 || clusterCut.Length()!=19 || mesonCut.Length()!=16 || clusterMergedCut.Length()!=19 ) {
175  cout << "ERROR in AliCutHandlerPCM: Incorrect length of cut string!" << endl;
176  fValidCutsEvent = kFALSE;
177  fValidCutsCalo = kFALSE;
178  fValidCutsMeson = kFALSE;
179  fValidCutsMergedCalo = kFALSE;
180  fValidCuts = false;
181  return;
182  }
183  fMode = 3;
184  fEventCutArray[fNCuts] = eventCut;
185  fMesonCutArray[fNCuts] = mesonCut;
186  fClusterCutArray[fNCuts] = clusterCut;
187  fMergedClusterCutArray[fNCuts] = clusterMergedCut;
188  fNCuts++;
189  return;
190 }
191 
192 
193 void AliCutHandlerPCM::AddCutPCMCalo(TString eventCut, TString photonCut, TString clusterCut, TString mesonCut){
194  if(fNCuts>=fNMaxCuts) {
195  cout << "ERROR in AliCutHandlerPCM: Exceeded maximum number of cuts!" << endl;
196  fValidCuts = false;
197  return;
198  }
199  if( eventCut.Length()!=8 || photonCut.Length()!=26 || clusterCut.Length()!=19 || mesonCut.Length()!=16 ) {
200  cout << "ERROR in AliCutHandlerPCM: Incorrect length of cut string!" << endl;
201  fValidCutsEvent = kFALSE;
202  fValidCutsPCM = kFALSE;
203  fValidCutsCalo = kFALSE;
204  fValidCutsMeson = kFALSE;
205  fValidCuts = false;
206  return;
207  }
208  fMode = 1;
209  fEventCutArray[fNCuts] = eventCut;
210  fPhotonCutArray[fNCuts] = photonCut;
211  fMesonCutArray[fNCuts] = mesonCut;
212  fClusterCutArray[fNCuts] = clusterCut;
213  fNCuts++;
214  return;
215 }
216 
217 
218 void AliCutHandlerPCM::AddCutPCMDalitz(TString eventCut, TString photonCut, TString electronCut, TString mesonCut){
219  if(fNCuts>=fNMaxCuts) {
220  cout << "ERROR in AliCutHandlerPCM: Exceeded maximum number of cuts!" << endl;
221  fValidCuts = false;
222  return;
223  }
224  if( eventCut.Length() !=8 || photonCut.Length() !=26 || electronCut.Length()!=20 || mesonCut.Length()!=16 ) {
225  cout << "ERROR in AliCutHandlerPCM: Incorrect length of cut string!" << endl;
226  fValidCutsEvent = kFALSE;
227  fValidCutsPCM = kFALSE;
228  fValidCutsElectron = kFALSE;
229  fValidCutsMeson = kFALSE;
230  fValidCuts = false;
231  return;
232  }
233  fMode = 1;
234  fEventCutArray[fNCuts] = eventCut;
235  fPhotonCutArray[fNCuts] = photonCut;
236  fMesonCutArray[fNCuts] = mesonCut;
237  fElectronCutArray[fNCuts] = electronCut;
238  fNCuts++;
239  return;
240 }
241 
242 void AliCutHandlerPCM::AddCutHeavyMesonPCM(TString eventCut, TString photonCut, TString pionCut, TString ndmCut, TString mesonCut){
243  if(fNCuts>=fNMaxCuts) {
244  cout << "ERROR in AliCutHandlerPCM: Exceeded maximum number of cuts!" << endl;
245  fValidCuts = false;
246  return;
247  }
248  if( eventCut.Length()!=8 || photonCut.Length()!=26 || pionCut.Length()!=9 || ndmCut.Length()!=16 || mesonCut.Length()!=16 ){
249  cout << "ERROR in AliCutHandlerPCM: Incorrect length of cut string!" << endl;
250  fValidCutsEvent = kFALSE;
251  fValidCutsPCM = kFALSE;
252  fValidCutsChargedPion = kFALSE;
253  fValidCutsNDM = kFALSE;
254  fValidCutsMeson = kFALSE;
255  fValidCuts = false;
256  }
257  fMode = 0;
258  fEventCutArray[fNCuts] = eventCut;
259  fPhotonCutArray[fNCuts] = photonCut;
260  fChargedPionCutArray[fNCuts] = pionCut;
262  fMesonCutArray[fNCuts] = mesonCut;
263  fNCuts++;
264  return;
265 }
266 
267 void AliCutHandlerPCM::AddCutHeavyMesonCalo(TString eventCut, TString clusterCut, TString pionCut, TString ndmCut, TString mesonCut){
268  if(fNCuts>=fNMaxCuts) {
269  cout << "ERROR in AliCutHandlerPCM: Exceeded maximum number of cuts!" << endl;
270  fValidCuts = false;
271  return;
272  }
273  if( eventCut.Length()!=8 || clusterCut.Length()!=19 || pionCut.Length()!=9 || ndmCut.Length()!=16 || mesonCut.Length()!=16 ){
274  cout << "ERROR in AliCutHandlerPCM: Incorrect length of cut string!" << endl;
275  fValidCutsEvent = kFALSE;
276  fValidCutsCalo = kFALSE;
277  fValidCutsChargedPion = kFALSE;
278  fValidCutsNDM = kFALSE;
279  fValidCutsMeson = kFALSE;
280  fValidCuts = false;
281  }
282  fMode = 0;
283  fEventCutArray[fNCuts] = eventCut;
284  fClusterCutArray[fNCuts] = clusterCut;
285  fChargedPionCutArray[fNCuts] = pionCut;
287  fMesonCutArray[fNCuts] = mesonCut;
288  fNCuts++;
289  return;
290 }
291 void AliCutHandlerPCM::AddCutHeavyMesonPCMCalo(TString eventCut,TString photonCut, TString clusterCut, TString pionCut, TString ndmCut, TString mesonCut){
292  if(fNCuts>=fNMaxCuts) {
293  cout << "ERROR in AliCutHandlerPCM: Exceeded maximum number of cuts!" << endl;
294  fValidCuts = false;
295  return;
296  }
297  if( eventCut.Length()!=8 || photonCut.Length()!=26 || clusterCut.Length()!=19 || pionCut.Length()!=9 || ndmCut.Length()!=16 || mesonCut.Length()!=16 ){
298  cout << "ERROR in AliCutHandlerPCM: Incorrect length of cut string!" << endl;
299  fValidCutsEvent = kFALSE;
300  fValidCutsPCM = kFALSE;
301  fValidCutsCalo = kFALSE;
302  fValidCutsChargedPion = kFALSE;
303  fValidCutsNDM = kFALSE;
304  fValidCutsMeson = kFALSE;
305  fValidCuts = false;
306  }
307  fMode = 0;
308  fEventCutArray[fNCuts] = eventCut;
309  fPhotonCutArray[fNCuts] = photonCut;
310  fClusterCutArray[fNCuts] = clusterCut;
311  fChargedPionCutArray[fNCuts] = pionCut;
313  fMesonCutArray[fNCuts] = mesonCut;
314  fNCuts++;
315  return;
316 }
317 
319  if(fNCuts>=fNMaxCuts) {
320  cout << "ERROR in AliCutHandlerPCM: Exceeded maximum number of cuts!" << endl;
321  fValidCuts = false;
322  return;
323  }
324  if( eventCut.Length()!=8 || photonCut.Length()!=26 ) {
325  cout << "ERROR in AliCutHandlerPCM: Incorrect length of cut string!" << endl;
326  fValidCutsEvent = kFALSE;
327  fValidCutsPCM = kFALSE;
328  fValidCuts = false;
329  return;
330  }
331  fMode = 0;
332  fEventCutArray[fNCuts] = eventCut;
333  fPhotonCutArray[fNCuts] = photonCut;
334  fNCuts++;
335  return;
336 }
337 
338 
339 
341  if(fValidCuts) return fNCuts;
342  else return 0;
343 }
344 
346  if(fValidCutsEvent&&i<fNMaxCuts&&i>=0)
347  return fEventCutArray[i];
348  else{
349  cout << "ERROR in AliCutHandlerPCM: GetEventCut wrong index i" << endl;
350  return "";
351  }
352 }
353 
355  if(fValidCutsPCM&&i<fNMaxCuts&&i>=0)
356  return fPhotonCutArray[i];
357  else {
358  cout << "ERROR in AliCutHandlerPCM: GetPhotonCut wrong index i" << endl;
359  return "";
360  }
361 }
362 
364  if(fValidCutsCalo&&i<fNMaxCuts&&i>=0)
365  return fClusterCutArray[i];
366  else {
367  cout << "ERROR in AliCutHandlerPCM: GetClusterCut wrong index i" << endl;
368  return "";
369  }
370 }
371 
372 
374  if(fValidCutsMergedCalo&&i<fNMaxCuts&&i>=0)
375  return fMergedClusterCutArray[i];
376  else {
377  cout << "ERROR in AliCutHandlerPCM: GetClusterMergedCut wrong index i" << endl;
378  return "";
379  }
380 }
381 
383  if(fValidCutsMeson&&i<fNMaxCuts&&i>=0)
384  return fMesonCutArray[i];
385  else {
386  cout << "ERROR in AliCutHandlerPCM: GetMesonCut wrong index i" << endl;
387  return "";
388  }
389 }
390 
392  if(fValidCutsElectron&&i<fNMaxCuts&&i>=0)
393  return fElectronCutArray[i];
394  else {
395  cout<<" ERROR in AliCutHandlerPCM: GetElectronCut wrong index i "<<endl;
396  return "";
397  }
398 }
399 
400 TString AliCutHandlerPCM::GetNDMCut(Int_t i){ // Neutral Decay Meson Cut
401  if(fValidCutsNDM&&i<fNMaxCuts&&i>=0)
402  return fNeutralDecayMesonCutArray[i];
403  else {
404  cout<<" ERROR in AliCutHandlerPCM: GetNDMCut wrong index i "<<endl;
405  return "";
406  }
407 }
408 
409 TString AliCutHandlerPCM::GetPionCut(Int_t i){ // Get charged pion cut
410  if(fValidCutsChargedPion&&i<fNMaxCuts&&i>=0)
411  return fChargedPionCutArray[i];
412  else {
413  cout<<" ERROR in AliCutHandlerPCM: GetPionCut wrong index i "<<endl;
414  return "";
415  }
416 }
417 
418 TString AliCutHandlerPCM::GetSpecialFileNameFromString (TString fileNameExternalInputs = "", TString configString = ""){
419  TObjArray *rfileNameExternalInputs = fileNameExternalInputs.Tokenize(";");
420  if(rfileNameExternalInputs->GetEntries()<1){
421  cout << "WARNING: Empty string in GetSpecialFileNameFromString during parsing of fileNameExternalInputs '" << fileNameExternalInputs.Data() << "'" << endl;
422  return "";
423  }
424  for(Int_t i = 0; i<rfileNameExternalInputs->GetEntries() ; i++){
425  TObjString* temp = (TObjString*) rfileNameExternalInputs->At(i);
426  TString tempStr = temp->GetString();
427  if(tempStr.BeginsWith(configString.Data())){
428  cout << "INFO: Found special file " << tempStr.Data() <<"!" << endl;
429  tempStr.Replace(0,5,"");
430  return tempStr;
431  }
432  }
433  return "";
434 }
435 
436 
438  TString additionalTrainConfig = "",
439  TString configString = "",
440  TString fileNameMatBudWeights = "",
441  TString addTaskName = "AddTask_GammaCalo_pp"
442 ){
443 
444  TObjArray *rAddConfigArr = additionalTrainConfig.Tokenize("_");
445  if(rAddConfigArr->GetEntries()<1){
446  cout << "WARNING: Empty string in GetSpecialSettingFromAddConfig during parsing of additionalTrainConfig String '" << additionalTrainConfig.Data() << "'" << endl;
447  return "";
448  }
449  for(Int_t i = 0; i<rAddConfigArr->GetEntries() ; i++){
450  if(!configString.CompareTo("")){
451  TObjString* temp = (TObjString*)rAddConfigArr->At(0);
452  TString tempStr = temp->GetString();
453  cout<< tempStr.Data()<<endl;
454  return tempStr;
455  } else {
456  TObjString* temp = (TObjString*) rAddConfigArr->At(i);
457  TString tempStr = temp->GetString();
458  cout<< tempStr.Data()<<endl;
459  if(tempStr.Contains("MaterialBudgetWeights") && !configString.CompareTo("MaterialBudgetWeights")){
460  TObjArray *fileNameMatBudWeightsArr = fileNameMatBudWeights.Tokenize("/");
461  if(fileNameMatBudWeightsArr->GetEntries()<1 ){
462  cout<<"ERROR: Empty string in GetSpecialSettingFromAddConfig when reading material budget weights file name" << fileNameMatBudWeights.Data()<< "'" << endl;
463  return "";
464  }
465  TObjString * oldMatObjStr = (TObjString*)fileNameMatBudWeightsArr->At( fileNameMatBudWeightsArr->GetEntries()-1);
466  TString oldfileName = oldMatObjStr->GetString();
467  TString newFileName = Form("MCInputFile%s.root",tempStr.Data());
468  cout<<newFileName.Data()<<endl;
469  if( oldfileName.EqualTo(newFileName.Data()) == 0 ){
470  fileNameMatBudWeights.ReplaceAll(oldfileName.Data(),newFileName.Data());
471  cout << "INFO: GetSpecialSettingFromAddConfig the material budget weights file has been changed to " <<fileNameMatBudWeights.Data()<<"'"<< endl;
472  return fileNameMatBudWeights;
473  }
474  } else if(tempStr.BeginsWith("CF") && !configString.CompareTo("CF")){
475  cout << "INFO: GetSpecialSettingFromAddConfig will use custom branch from Correction Framework!" << endl;
476  tempStr.Replace(0,2,"");
477  return tempStr;
478  } else if(tempStr.BeginsWith("TM") && !configString.CompareTo("TM")){
479  tempStr.Replace(0,2,"");
480  cout << Form("INFO: GetSpecialSettingFromAddConfig will use running mode '%i' for the TrackMatcher!",tempStr.Atoi()) << endl;
481  return tempStr;
482  }else if(tempStr.CompareTo("EPCLUSTree") == 0&& !configString.CompareTo("EPCLUSTree")){
483  cout << "INFO: "<< addTaskName.Data() << " activating 'EPCLUSTree'" << endl;
484  return "1";
485  }else if(tempStr.CompareTo("INVMASSCLUSTree") == 0&& !configString.CompareTo("INVMASSCLUSTree")){
486  cout << "INFO: "<< addTaskName.Data() << " activating 'INVMASSCLUSTree'" << endl;
487  return "1";
488  }else if(tempStr.BeginsWith("MODIFYACC")&& !configString.CompareTo("MODIFYACC")){
489  cout << "INFO: "<< addTaskName.Data() << " activating 'MODIFYACC'" << endl;
490  return tempStr;
491  }else if(tempStr.BeginsWith("LOCALDEBUGFLAG")&& !configString.CompareTo("LOCALDEBUGFLAG")){
492  cout << "INFO: "<< addTaskName.Data() << " activating 'LOCALDEBUGFLAG'" << endl;
493  TString tempType = tempStr;
494  tempType.Replace(0,14,"");
495  return tempType;
496  }
497  }
498  }
499  return "";
500 }
TString * fClusterCutArray
TString GetMesonCut(Int_t i)
TString * fNeutralDecayMesonCutArray
void AddCutPCMMaterial(TString eventCut, TString photonCut)
TString GetSpecialSettingFromAddConfig(TString additionalTrainConfig, TString configString, TString fileNameMatBudWeights, TString addTaskName)
TString GetPhotonCut(Int_t i)
TString GetClusterMergedCut(Int_t i)
TString * fMesonCutArray
TString GetSpecialFileNameFromString(TString fileNameExternalInputs, TString configString)
TString * fChargedPionCutArray
void AddCutCalo(TString eventCut, TString clusterCut, TString mesonCut)
TString * fMergedClusterCutArray
void AddCutPCMCalo(TString eventCut, TString photonCut, TString clusterCut, TString mesonCut)
TString GetElectronCut(Int_t i)
int Int_t
Definition: External.C:63
TString GetEventCut(Int_t i)
TString * fEventCutArray
TString * fElectronCutArray
void AddCutPCM(TString eventCut, TString photonCut, TString mesonCut)
void AddCutHeavyMesonPCMCalo(TString eventCut, TString photonCut, TString clusterCut, TString pionCut, TString ndmCut, TString mesonCut)
TString GetNDMCut(Int_t i)
void AddCutHeavyMesonCalo(TString eventCut, TString clusterCut, TString pionCut, TString ndmCut, TString mesonCut)
void AddCutPCMDalitz(TString eventCut, TString photonCut, TString mesonCut, TString electronCut)
void AddCutHeavyMesonPCM(TString eventCut, TString photonCut, TString pionCut, TString ndmCut, TString mesonCut)
void AddCutMergedCalo(TString eventCut, TString clusterCut, TString clusterMergedCut, TString mesonCut)
Bool_t fValidCutsChargedPion
TString * fPhotonCutArray
TString GetClusterCut(Int_t i)
TString GetPionCut(Int_t i)