]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/TPCcalib/AliTPCcalibTracksCuts.cxx
Do not assume operator==/!=() is a member function.
[u/mrichter/AliRoot.git] / TPC / TPCcalib / AliTPCcalibTracksCuts.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 #include <TString.h>
17 #include <TChain.h>
18 #include <TList.h>
19 #include "AliTPCcalibTracksCuts.h"
20
21 ClassImp(AliTPCcalibTracksCuts);
22
23 AliTPCcalibTracksCuts::AliTPCcalibTracksCuts(Int_t minClusters, Float_t minRatio, Float_t max1pt,
24    Float_t edgeXZCutNoise, Float_t edgeThetaCutNoise, char* outputFileName):
25       TNamed("calibTracksCuts", "calibTracksCuts") {
26    //
27    // Constructor for AliTPCcalibTracksCuts
28    // specify the cuts to be set on the processed tracks
29    // default cuts are for comics
30    //
31    fMinClusters = minClusters;
32    fMinRatio = minRatio;
33    fMax1pt = max1pt;
34    fEdgeYXCutNoise = edgeXZCutNoise;
35    fEdgeThetaCutNoise = edgeThetaCutNoise;
36    fOutputFileName = new TObjString(outputFileName);
37 }
38
39 AliTPCcalibTracksCuts::AliTPCcalibTracksCuts(AliTPCcalibTracksCuts *cuts){
40    // 
41    // copy constructor
42    // 
43    fMinClusters = cuts->GetMinClusters();
44    fMinRatio = cuts->GetMinRatio();
45    fMax1pt = cuts->GetMax1pt();
46    fEdgeYXCutNoise = cuts->GetEdgeYXCutNoise();
47    fEdgeThetaCutNoise = cuts->GetEdgeThetaCutNoise();
48    fOutputFileName = new TObjString(cuts->GetOutputFileName());
49 }
50
51 AliTPCcalibTracksCuts::AliTPCcalibTracksCuts(){
52    // 
53    // default constructor
54    // 
55    fMinClusters = 0;
56    fMinRatio = 0;
57    fMax1pt = 0;
58    fEdgeYXCutNoise = 0;
59    fEdgeThetaCutNoise = 0;
60    fOutputFileName = new TObjString("");
61 }
62
63 void AliTPCcalibTracksCuts::AddCuts(TChain * chain, char* ctype, char* outputFileName){
64    // 
65    // add predefined cuts to the chain for processing
66    // (creates AliTPCcalibTracksCuts object)
67    // the cuts are set in the following order:
68    // fMinClusters (number of clusters)
69    // fMinRatio 
70    // fMax1pt   1  over p_t
71    // fEdgeYXCutNoise
72    // fEdgeThetaCutNoise
73    // 
74    // The following predefined sets of cuts can be selected:
75    // laser:      20, 0.4, 0.5, 0.13, 0.018
76    // cosmic:     20, 0.4, 0.5, 0.13, 0.018
77    // lowflux:    20, 0.4, 5, 0.2, 0.0001
78    // highflux:   20, 0.4, 5, 0.2, 0.0001
79    // 
80    
81    TString cutType(ctype);
82    cutType.ToUpper();
83    AliTPCcalibTracksCuts *cuts = 0;
84    if (cutType == "LASER")
85 //       cuts = new AliTPCcalibTracksCuts(20, 0.4, 0.5, 0.13, 0.018);
86       cuts = new AliTPCcalibTracksCuts(20, 0.4, 5, 0.13, 0.018, outputFileName);
87    else if (cutType == "COSMIC")
88       cuts = new AliTPCcalibTracksCuts(20, 0.4, 0.5, 0.13, 0.018, outputFileName);
89    else if (cutType == "LOWFLUX")
90       cuts = new AliTPCcalibTracksCuts(20, 0.4, 5, 0.2, 0.0001, outputFileName);
91    else if (cutType == "HIGHFLUX")
92       cuts = new AliTPCcalibTracksCuts(20, 0.4, 5, 0.2, 0.0001, outputFileName);
93    else {
94       cuts = new AliTPCcalibTracksCuts(20, 0.4, 5, 0.2, 0.0001, outputFileName);
95       cerr << "WARNING! unknown type '" << ctype << "', cuts set to default values for cosmics." << endl;
96       cutType = "COSMIC";
97    }
98    chain->GetUserInfo()->AddLast(cuts);
99    cout << "Cuts were set to predefined set: " << cutType << endl;
100 }
101
102 void AliTPCcalibTracksCuts::AddCuts(TChain * chain, Int_t minClusters, Float_t minRatio, Float_t max1pt,
103       Float_t edgeXZCutNoise, Float_t edgeThetaCutNoise, char* outputFileName){
104    // 
105    // add user defined cuts to the chain for processing
106    // (creates AliTPCcalibTracksCuts object)
107    // the cuts are set in the following order:
108    // fMinClusters (number of clusters)
109    // fMinRatio 
110    // fMax1pt   1  over p_t
111    // fEdgeYXCutNoise
112    // fEdgeThetaCutNoise
113    // 
114    chain->GetUserInfo()->AddLast(new AliTPCcalibTracksCuts(minClusters, minRatio, max1pt, edgeXZCutNoise, edgeThetaCutNoise, outputFileName));
115    printf("Cuts were set to the individal values: minClusters: %i, minRatio: %f, max1pt: %f, edgeXZCutNoise: %f, edgeThetaCutNoise: %f \n", 
116       minClusters, minRatio, max1pt, edgeXZCutNoise, edgeThetaCutNoise);
117 }
118
119 void AliTPCcalibTracksCuts::Print(Option_t* option) {
120    option = option;  // to avoid compiler warnings
121    cout << "<AliTPCcalibTracksCuts>: The following cuts are specified: " << endl;
122    cout << "fMinClusters: " << fMinClusters << endl;
123    cout << "fMinRatio: " << fMinRatio << endl;
124    cout << "fMax1pt: " << fMax1pt << endl;
125    cout << "fEdgeYXCutNoise: " << fEdgeYXCutNoise << endl;
126    cout << "fEdgeThetaCutNoise: " << fEdgeThetaCutNoise << endl;
127    cout << "fOutputFileName: " << fOutputFileName->String().Data() << endl;
128 }  // Prints out the specified cuts