+++ /dev/null
-#ifndef ALI_MUON_ST1_CONTAINERS_H
-#define ALI_MUON_ST1_CONTAINERS_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-// AliMUONSt1Containers
-// --------------------
-// Compiler directive for selection of containers type:
-// Either STL or ROOT
-//
-// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-//
-
-#define ST1_WITH_ROOT
-//#define ST1_WITH_STL
-
-#endif //ALI_MUON_ST1_CONTAINERS_H
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-
-// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-//
-// Class AliMUONSt1Decoder
-// -----------------------
-// A generic set of functions (defined in the <decoder> namespace).
-// Used to decode formatted strings, eg. a list of integer ranges,
-// or a list of sub-strings separated by delimiters such as '(','{','[', ... .
-// Example:
-// (string 1) (string 2) [string3] {string4} [ (string5.1) (string5.2) ]
-// note : |_____________________|
-// |
-// this is just ONE substring.
-// Included in AliRoot 2003/01/28
-
-#include "AliMUONSt1Decoder.h"
-
-//_____________________________________________________________________
-StringVector decoder::SplitNtuples(const string& s,
- const string& leftSep,
- const string& rightSep)
-
-{
-// separate substrings in <s>, by using the first level of delimiters
-// given in the argument
-// Example:
-// (string 1) (string 2) [string3] {string4} [ (string5.1) (string5.2) ]
-// returns a list of 5 substrings
-// "string 1"
-// "string 2"
-// "string 3"
-// "string 4" and
-// " (string5.1) (string5.2) "
-// --
- StringVector ans;
- string::size_type idx = 0;
- do {
- idx = s.find_first_of(leftSep,idx);
- if (idx != string::npos) {
- string::size_type sepNum = leftSep.find_first_of(s[idx],0);
- if (sepNum>=rightSep.length()){
- idx++;
- continue;
- }
- Int_t count=1;
- string::size_type idx2 = idx+1;
- while ((count>0) && (idx2<s.length())){
- if (s[idx2] == leftSep[sepNum]) count++;
- if (s[idx2] == rightSep[sepNum]) count--;
- idx2++;
- }
- if (count != 0) return ans; // bad format...stop here
- ans.push_back(s.substr(idx+1,idx2-idx-2));
- idx=idx2;
- }
- } while (idx != string::npos);
- return ans;
-}
-
-//_____________________________________________________________________
-StringVector decoder::SplitList(const string& s,const string& sep)
-{
-// split <s> into several substrings, by using any of the delimters in <sep>
-// Example : str1 ; str2 , str3
-// gives a list of 3 substrings ("str1", "str2" and "str3") if
-// the delimiter parameter is ",;"
-// and a list of 2 substrings ("str1","str2,str3") if
-// the delimiter parameter is ";"
-// --
- StringVector ans;
- string::size_type i=0,j;
- while ((j=s.find_first_of(sep,i))!=string::npos){
- ans.push_back(s.substr(i,j-i));
- i=j+1;
- }
- ans.push_back(s.substr(i,s.length()-i));
- return ans;
-}
-
-//_____________________________________________________________________
-IntVector
-decoder::DecodeListRanges(const string& s, const string& sep,
- const string& rangeSep)
-{
-// decode <s> as a list of integers
-// Example: 192/199 ; -10/-7
-// gives a list of 12 integers:
-// 192, 193, 194, 195, 196, 197, 198, 199, -10, -9, -8, -7
-// --
- IntVector ans;
- IntPairVector rangeList = DecodeListOfIntRanges(s,sep,rangeSep);
- for (UInt_t i = 0 ;i<rangeList.size();i++){
- for (Int_t j=rangeList[i].first;j<=rangeList[i].second;j++){
- ans.push_back(j);
- }
- }
- return ans;
-}
-
-//_____________________________________________________________________
-IntPairVector
-decoder::DecodeListOfIntRanges(const string& s, const string& sep,
- const string& rangeSep)
-{
-// decodes <s> as a list of int ranges
-// Example: 192/303 ; -10/-1
-// gives a list of two int pairs:
-// pair(192,303) and another pair (-10,-1)
-// --
- string::size_type i=0;
- IntPairVector ans;
- if (s.empty()) return ans;
-
- StringVector parts = decoder::SplitList(s,sep);
-
- for (UInt_t k=0;k<parts.size();k++){
- i=parts[k].find_first_of(rangeSep);
- Int_t from,to;
- if (i == string::npos) {
- from = atoi(parts[k].c_str());
- to = from;
- } else {
- from=atoi(parts[k].substr(0,i).c_str());
- to =atoi(parts[k].substr(i+1,parts[k].length()-i-1).c_str());
- }
- ans.push_back(IntPair(from,to));
- }
- return ans;
-}
-
-//_____________________________________________________________________
-DoublePairVector
-decoder::DecodeListOfFloatRanges(const string& s, const string& sep,
- const string& rangeSep)
-{
-// decodes <s> as a list of double (floating point) ranges
-// Example : 192.33/303.26 ; -10.2/-1.41
-// gives a list of two double precision floating point (phew!) pairs:
-// pair (192.33,303.26) and another pair (-10.2,-1.41)
-// --
- string::size_type i=0;
- DoublePairVector ans;
- if (s.empty()) return ans;
-
- StringVector parts = decoder::SplitList(s,sep);
-
- for (UInt_t k=0;k<parts.size();k++){
- i=parts[k].find_first_of(rangeSep);
- Double_t from,to;
- if (i == string::npos) {
- from = atof(parts[k].c_str());
- to = from;
- } else {
- from=atof(parts[k].substr(0,i).c_str());
- to =atof(parts[k].substr(i+1,parts[k].length()-i-1).c_str());
- }
- ans.push_back(DoublePair(from,to));
- }
- return ans;
-}
+++ /dev/null
-#ifndef ALI_MUON_ST1_DECODER_H
-#define ALI_MUON_ST1_DECODER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-// Revision of includes 07/05/2004
-
-/// \ingroup sim
-/// \class AliMUONSt1Decoder
-/// \brief Set of functions to decode formatted strings
-///
-/// A generic set of functions (defined in the <decoder> namespace).
-/// Used to decode formatted strings, eg. a list of integer ranges,
-/// or a list of sub-strings separated by delimiters such as '(','{','[', ... .
-/// Example: \n
-/// (string 1) (string 2) [string3] {string4} [ (string5.1) (string5.2) ] \n
-/// note : |_____________________| \n
-/// | \n
-/// this is just ONE substring. \n
-///
-/// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-
-#include <Rtypes.h>
-#include <string>
-#include <utility>
-#include <vector>
-
-#ifndef __HP_aCC
- using std::string;
- using std::pair;
- using std::vector;
-#endif
-
-typedef vector<string> StringVector;
-typedef vector<Int_t> IntVector;
-typedef pair<Int_t, Int_t> IntPair;
-typedef vector<IntPair> IntPairVector;
-typedef pair<Double_t, Double_t> DoublePair;
-typedef vector<DoublePair> DoublePairVector;
-
-namespace decoder
-{
- StringVector SplitNtuples(const string& s,
- const string& leftSep ="({[\"'/",
- const string& rightSep=")}]\"'/");
- StringVector SplitList(const string& s, const string& sep=";,");
-
- IntVector DecodeListRanges(const string& s, const string& sep=";,",
- const string& rangeSep="/");
- IntPairVector DecodeListOfIntRanges(const string& s, const string& sep=";,",
- const string& rangeSep="/");
- DoublePairVector DecodeListOfFloatRanges(const string& s, const string& sep=";,",
- const string& rangeSep="/");
-}
-
-#endif //ALI_MUON_ST1_DECODER_H
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-
-// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-//
-// Class AliMUONSt1ElectronicElement
-// ---------------------------------
-// Describes a set of pads either by defining
-// a range of indices, or
-// a range of (centimeters) positions or
-// a range of electronic channel numbers or
-// a range of MANU numbers or, finally,
-// a range of gassiplex/MANAS numbers, in a given range of MANU addresses
-// Included in AliRoot 2003/01/28
-
-#include "AliMUONSt1ElectronicElement.h"
-#include "AliMpPad.h"
-
-ClassImp(AliMUONSt1ElectronicElement)
-
-//______________________________________________________________________________
-AliMUONSt1ElectronicElement::AliMUONSt1ElectronicElement()
- :TObject(),fDescription(kNone)
-{
-// default constructor
-}
-
-//______________________________________________________________________________
-AliMUONSt1ElectronicElement::AliMUONSt1ElectronicElement(TDescription descr)
- :TObject(),fDescription(descr)
-{
-// normal constructor
- switch (descr){
- case kXY : SetRange(0,0.,0.); SetRange(1,0.,0.); break;
- default: SetRange(0,0,0); SetRange(1,0,0); break;
- }
-}
-
-//______________________________________________________________________________
-AliMUONSt1ElectronicElement::~AliMUONSt1ElectronicElement()
-{
-// destructor
-}
-
-//______________________________________________________________________________
-void AliMUONSt1ElectronicElement::SetRange(Int_t numVar,Int_t i1,Int_t i2)
-{
-// set the range of the <numVar>th variables, in all cases but kXY
-// ---
-
- if (fDescription==kXY) {
- fRanges[numVar][0].x = (Double_t)i1;
- fRanges[numVar][1].x = (Double_t)i2;
- } else {
- fRanges[numVar][0].i = i1;
- fRanges[numVar][1].i = i2;
- }
-}
-
-//______________________________________________________________________________
-void AliMUONSt1ElectronicElement::SetRange(Int_t numVar,Double_t x1,Double_t x2)
-{
-// set the range of the <numVar>th variable, in cases kXY
-// ---
-
- if (fDescription==kXY) {
- fRanges[numVar][0].x = x1;
- fRanges[numVar][1].x = x2;
- } else {
- fRanges[numVar][0].i = (Int_t)x1;
- fRanges[numVar][1].i = (Int_t)x2;
- }
-}
-
-//______________________________________________________________________________
-Bool_t AliMUONSt1ElectronicElement::IsInRange(Int_t numVar,Int_t i) const
-{
-// is the given value in the <numVar>th variable
-// ---
-
- return (fRanges[numVar][0].i<=i) && (fRanges[numVar][1].i>=i);
-}
-
-//______________________________________________________________________________
-Bool_t AliMUONSt1ElectronicElement::IsInRange(Int_t numVar,Double_t x) const
-{
-// is the given value in the <numVar>th variable
-// ---
-
- return (fRanges[numVar][0].x<=x) && (fRanges[numVar][1].x>=x);
-}
-
-//______________________________________________________________________________
-Bool_t AliMUONSt1ElectronicElement::Contains(const AliMpPad& pad) const
-{
-// is the pad <pad> contained in this range
-// ---
-
- switch(fDescription){
- case kNone:
- return kFALSE;
- case kIJ :
- return ( IsInRange(0,pad.GetIndices().GetFirst())
- && IsInRange(1,pad.GetIndices().GetSecond())
- );
- case kXY :
- return ( IsInRange(0,pad.Position().X())
- && IsInRange(1,pad.Position().Y())
- );
- case kMGC :
- return ( IsInRange(0,pad.GetLocation().GetFirst())
- && IsInRange(1,pad.GetLocation().GetSecond())
- );
- case kMG :
- return ( IsInRange(0,pad.GetLocation().GetFirst())
- && IsInRange(1,pad.GetLocation().GetSecond() >> 4)
- );
- case kM :
- return ( IsInRange(0,pad.GetLocation().GetFirst()));
-
- default: return kFALSE;
- }
-}
+++ /dev/null
-#ifndef ALI_MUON_ST1_ELECTRONIC_ELEMENT_H
-#define ALI_MUON_ST1_ELECTRONIC_ELEMENT_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-// Revision of includes 07/05/2004
-
-/// \ingroup sim
-/// \class AliMUONSt1ElectronicElement
-/// \brief Describes a set of pads defined by different ways
-///
-/// Describes a set of pads either by defining
-/// - a range of indices, or
-/// - a range of (centimeters) positions or
-/// - a range of electronic channel numbers or
-/// - a range of MANU numbers or, finally,
-/// - a range of gassiplex/MANAS numbers, in a given range of MANU addresses
-///
-/// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-
-#include <TObject.h>
-
-class AliMpPad;
-
-class AliMUONSt1ElectronicElement : public TObject
-{
- public:
- enum TDescription {kNone, kIJ, kXY, kMGC, kMG, kM};
-
- public:
- AliMUONSt1ElectronicElement();
- AliMUONSt1ElectronicElement(TDescription descr);
- virtual ~AliMUONSt1ElectronicElement();
-
- // methods
- Bool_t Contains(const AliMpPad& pad) const;
- void SetRange(Int_t numVar,Int_t i1,Int_t i2);
- void SetRange(Int_t numVar,Double_t x1,Double_t x2);
- Bool_t IsInRange(Int_t numVar,Int_t i) const;
- Bool_t IsInRange(Int_t numVar,Double_t x) const;
-
- private:
- typedef union {Int_t i; Double_t x;} TData;
-
- TDescription fDescription; // how the pad range is described
- TData fRanges[2][2]; // range of the 2 variables
-
- ClassDef(AliMUONSt1ElectronicElement,1) //range of electronic elements
-};
-#endif //ALI_MUON_ST1_ELECTRONIC_ELEMENT_H
-
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-
-// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-//
-// Class AliMUONIniReader
-// ----------------------
-// General class to read data in ASCII file format,
-// similar to the Windows ".ini" files (a set of sections tagged by a
-// [ sectionName ]
-// and values defined in the way:
-// parameterName = value
-//
-// comment lines can be introduced if the first non-blank character
-// is either ';' or '#'
-// Included in AliRoot 2003/01/28
-
-#if !defined(__HP_aCC) && !defined(__alpha)
- #include <sstream>
-#endif
-
-#include <Riostream.h>
-#include <Rstrstream.h>
-
-#include "AliMUONSt1IniReader.h"
-
-//______________________________________________________________________
-AliMUONSt1IniReader::AliMUONSt1IniReader()
- :fFile(),fCurrentType(kUndef),fEndOfFile(true)
-{
-// default constructor
-// ---
-}
-
-//______________________________________________________________________
-AliMUONSt1IniReader::AliMUONSt1IniReader(string fileName)
-{
-// normal constructor
-// ---
-
- fFile.open(fileName.c_str());
- if (!fFile) {cerr<<"Unable to open file "<<fileName<<endl;}
- fEndOfFile = !fFile.good();
- fCurrentType=kUndef;
-}
-
-//______________________________________________________________________
-AliMUONSt1IniReader::~AliMUONSt1IniReader()
-{
- //destructor
- fFile.close();
-}
-
-//______________________________________________________________________
-void AliMUONSt1IniReader::Reset()
-{
-// Reset the input stream. The file can be re-read after calling this function
-// ---
-
- fFile.clear();
- fFile.seekg(0,ios::beg);
- fCurrentType=kUndef;
- fEndOfFile=!fFile.good();
-}
-
-//______________________________________________________________________
-bool AliMUONSt1IniReader::ReadNextLine()
-{
-// The main function of this class.
-// Read next line in the file and set CurrentType(), CurrentName() and
-// CurrentValue() with the line's content
-// ---
-
- if ( (!fFile) || (fFile.eof()) || (!fFile.good()) )
- {fEndOfFile=true; fCurrentType=kUndef; return false;}
-
- string line;
- getline(fFile,line);
- if ( line.empty()) { // this is a blank line
- return ReadNextLine();
- }
-#if defined (__HP_aCC) || (__alpha)
- strstream l;
- l << line;
-#else
- istringstream l(line);
-#endif
-
- char c;
-
- l>>c;
- if ( (c==';') || (c=='#') ) { // this is a comment
- return ReadNextLine();
- }
-
- if (c=='[') { // this is a chapter name
- getline(l,fCurrentName,']');
- fCurrentName=Trail(fCurrentName);
- fCurrentType=kChapter;
- return true;
- } else {
- if (line.find_first_of("=") != string::npos ) {
- l.putback(c);
- getline(l,fCurrentName,'=');
- fCurrentName = Trail(fCurrentName);
-
- getline(l,fCurrentValue);
- fCurrentValue = Trail(fCurrentValue);
- fCurrentType=kValue;
- return true;
- } else {
- cerr<<"Warning, badly formated line..."<<line<<endl;
- fCurrentType=kUndef;
- return false;
- }
- }
- // fCurrentType=kUndef;
- // return false;
- // unreachable
-}
-
-//______________________________________________________________________
-AliMUONSt1IniReader::ValueList AliMUONSt1IniReader::MakeCurrentValueList()
-{
-// Read the next lines in the file
-// until eof() or a new section is found.
-// Return the list of (name,value) pairs read.
-// ---
-
- ValueList ans;
- while (true){
- if (fCurrentType==kValue){
- ans.push_back( ValuePair(fCurrentName,fCurrentValue));
- } else break;
- ReadNextLine();
- }
- return ans;
-}
-
-//______________________________________________________________________
-AliMUONSt1IniReader::Chapter AliMUONSt1IniReader::MakeCurrentChapter()
-{
-// Searches in the rest file for a new section
-// and return it's name and the list of (name,value) pairs in it
-// ---
-
- while ((!Eof()) && (fCurrentType != kChapter)) ReadNextLine();
- if (Eof()) return Chapter();
- string name = fCurrentName;
- ReadNextLine();
- return Chapter(name,MakeCurrentValueList());
-}
-
-//______________________________________________________________________
-AliMUONSt1IniReader::ChapterList AliMUONSt1IniReader::MakeChapterList()
-{
-// Read the rest of the file and return all the chapter names and
-// (name,value) pair lists found after the current position
-// ---
-
- ChapterList ans;
- while (true) {
- if (fCurrentType==kChapter) {
- string s= fCurrentName;
- ReadNextLine();
- //ans.insert(Chapter(s,MakeCurrentValueList()));
- // does not compile on SunOS
- ans.insert(ChapterList::value_type(s,MakeCurrentValueList()));
- } else ReadNextLine();
- if (fEndOfFile) break;
- }
- return ans;
-}
-
-//______________________________________________________________________
-string AliMUONSt1IniReader::Trail(const string& s) const
-{
-// Utility function: clear the blanks before and after the string <s>
-// ---
-
- string::size_type p1=s.find_first_not_of(" ");
- if (p1==string::npos) return "";
- string::size_type p2=s.find_last_not_of(" ");
- return s.substr(p1,p2-p1+1);
-}
+++ /dev/null
-#ifndef ALI_MUON_ST1_INI_READER_H
-#define ALI_MUON_ST1_INI_READER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-// Revision of includes 07/05/2004
-
-/// \ingroup sim
-/// \class AliMUONSt1IniReader
-/// \brief General class to read data in a special ASCII file format
-///
-/// General class to read data in ASCII file format,
-/// similar to the Windows ".ini" files (a set of sections tagged by a \n
-/// [ sectionName ] \n
-/// and values defined in the way: \n
-/// parameterName = value \n
-///
-/// comment lines can be introduced if the first non-blank character
-/// is either ';' or '#'
-///
-/// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-
-
-#include <string>
-#include <vector>
-#include <map>
-#include <utility>
-#include <fstream>
-
-#ifndef __HP_aCC
- using std::string;
- using std::pair;
- using std::vector;
- using std::multimap;
-#endif
-
-class AliMUONSt1IniReader
-{
- public:
- enum IniType {kUndef, kChapter, kValue};
-
- typedef pair<string, string> ValuePair;
- typedef vector<ValuePair> ValueList;
- typedef pair<string, ValueList> Chapter;
- typedef multimap <string, ValueList> ChapterList;
-
- public:
- AliMUONSt1IniReader();
- AliMUONSt1IniReader(string fileName);
- virtual ~AliMUONSt1IniReader();
-
- bool ReadNextLine();
- IniType GetCurrentType() const {return fCurrentType; }
- string GetCurrentName() const {return fCurrentName; }
- string GetCurrentValue() const {return fCurrentValue;}
- Chapter MakeCurrentChapter();
- ValueList MakeCurrentValueList();
- ChapterList MakeChapterList();
- bool Eof() const {return fEndOfFile;}
- void Reset() ;
-
- private:
- string Trail(const string& s) const;
-
- ifstream fFile; // the file to be read
- IniType fCurrentType; // current type of line (either kChapter or kValue)
- string fCurrentName; // name of chapter / name of parameter pair
- string fCurrentValue;// value of the parameter pair if the type is kValue
- bool fEndOfFile; // true if the file is entirely read
-};
-
-#endif //ALI_MUON_ST1_INI_READER_H
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-
-// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-//
-// Class AliMUONSt1Response
-// ----------------------------
-// Response class for station 1 including electronics and detector response.
-// Individual pedestals or noise levels can be controlled separately.
-// The current pulse height responses do not contain any physics
-// Included in AliRoot 2003/01/28
-
-#include <TMath.h>
-#include <TRandom.h>
-#include <TSystem.h>
-#include <Riostream.h>
-
-#include "AliMpIntPair.h"
-#include "AliMpSectorSegmentation.h"
-#include "AliMpPad.h"
-#include "AliMpMotifMap.h"
-#include "AliMpSector.h"
-#include "AliMpZone.h"
-#include "AliMpSubZone.h"
-#include "AliMpVRowSegment.h"
-
-#include "AliMUONSt1Response.h"
-#include "AliMUONSt1ResponseParameter.h"
-#include "AliMUONSt1ResponseRule.h"
-#include "AliMUONSt1IniReader.h"
-#include "AliMUONSt1Decoder.h"
-#include "AliMUONTransientDigit.h"
-#include "AliMUONSegmentation.h"
-#include "AliMUONGeometrySegmentation.h"
-#include "AliMUONSt12QuadrantSegmentation.h"
-#include "AliMUON.h"
-#include "AliRun.h"
-#include "AliLog.h"
-
-const TString AliMUONSt1Response::fgkTopDir = getenv("ALICE_ROOT");
-const TString AliMUONSt1Response::fgkDataDir = "/MUON/data/";
-const TString AliMUONSt1Response::fgkConfigBaseName = "configChamber";
-const TString AliMUONSt1Response::fgkStandardIniFileName = "st1StdParameter.ini";
-
-const TString AliMUONSt1Response::fgkBaseName ="base";
-const TString AliMUONSt1Response::fgkIncludeName ="include";
-const TString AliMUONSt1Response::fgkParameterName ="parameter";
-const TString AliMUONSt1Response::fgkRegionName ="region";
-const TString AliMUONSt1Response::fgkRuleName ="rule";
-const TString AliMUONSt1Response::fgkNameName ="name";
-const TString AliMUONSt1Response::fgkPedestalName ="pedestal";
-const TString AliMUONSt1Response::fgkNoiseName ="noise";
-const TString AliMUONSt1Response::fgkStateName ="state";
-const TString AliMUONSt1Response::fgkMName ="padM";
-const TString AliMUONSt1Response::fgkMGName ="padMG";
-const TString AliMUONSt1Response::fgkMGCName ="padMGC";
-const TString AliMUONSt1Response::fgkIJName ="padIJ";
-const TString AliMUONSt1Response::fgkXYName ="padXY";
-const TString AliMUONSt1Response::fgkZoneName ="zone";
-const TString AliMUONSt1Response::fgkStickyOnName ="stickyOn";
-const TString AliMUONSt1Response::fgkStickyOffName ="stickyOff";
-const TString AliMUONSt1Response::fgkFileName ="file";
-const TString AliMUONSt1Response::fgkValueName ="value";
-const TString AliMUONSt1Response::fgkGausName ="gaus";
-const TString AliMUONSt1Response::fgkNotName ="no";
-const TString AliMUONSt1Response::fgkNofSigmaName ="nofSigma";
-
-ClassImp(AliMUONSt1Response)
-
-//__________________________________________________________________________
-AliMUONSt1Response::AliMUONSt1Response(Int_t chamberId)
- : AliMUONResponseV0(),
- fReadFiles(kTRUE),
- fCountNofCalls(0),
- fCountUnknownZone(0),
- fCountUnknownIndices(0),
- fChamberId(chamberId),
- fParams(),
- fRegions(),
- fTrashList()
-
-{
-// Standard constructor
-
- // default pedestal value
- fCountNofCalls=0;
- fCountUnknownZone=0;
- fCountUnknownIndices=0;
-
- Int_t i;
- for (i=0;i<2;i++){
- fIniFileName[i]="";
- for (Int_t j=0;j<fgkNofZones;j++)
- {
- fDefaultParameters[i][j]=0;
- }
- }
- fTrashList.SetOwner(kTRUE);
-}
-
-
-//__________________________________________________________________________
-AliMUONSt1Response::AliMUONSt1Response()
- : AliMUONResponseV0(),
- fReadFiles(kTRUE),
- fCountNofCalls(0),
- fCountUnknownZone(0),
- fCountUnknownIndices(0),
- fChamberId(0),
- fParams(),
- fRegions(),
- fTrashList()
-
-{
-// Standard constructor
-
- Int_t i;
- for (i=0;i<2;i++){
- fIniFileName[i]="";
- for (Int_t j=0;j<fgkNofZones;j++)
- {
- fDefaultParameters[i][j]=0;
- }
- }
- fTrashList.SetOwner(kTRUE);
-}
-
-
-//__________________________________________________________________________
-AliMUONSt1Response::AliMUONSt1Response(const AliMUONSt1Response& rhs)
- : AliMUONResponseV0(rhs)
-{
-// Copy constructor
-
- AliFatal("Copy constructor is not implemented.");
-}
-
-//__________________________________________________________________________
-AliMUONSt1Response::~AliMUONSt1Response()
-{
-//destructor
- Int_t i;
- for (i=0;i<2;i++){
- fTrashList.Delete();
- }
-}
-
-//
-// operators
-//
-
-//______________________________________________________________________________
-AliMUONSt1Response&
-AliMUONSt1Response::operator=(const AliMUONSt1Response& rhs)
-{
-// Copy operator
-
- // check assignement to self
- if (this == &rhs) return *this;
-
- AliFatal("Assignment operator is not implemented.");
-
- return *this;
-}
-
-//__________________________________________________________________________
-void AliMUONSt1Response::SetIniFileName(Int_t plane,const TString& fileName)
-{
-// Set the file to be read for the response parameters
- if ((plane>=0) && (plane<=1)) fIniFileName[plane] = fileName;
-}
-
-
-//__________________________________________________________________________
-const AliMUONGeometrySegmentation*
-AliMUONSt1Response::GetGeometrySegmentation(Int_t cathod)
-{
-// Get geometry segmentation for given cathod plane
-
- AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
- AliMUONGeometrySegmentation* segmentation
- = muon->GetSegmentation()->GetModuleSegmentation(fChamberId, cathod-1);
-
- if (!segmentation)
- AliFatal(Form("Geometry segmentation for cathod %d not defined.", cathod));
-
- return segmentation;
-}
-
-//__________________________________________________________________________
-const AliMpSectorSegmentation*
-AliMUONSt1Response::GetMpSegmentation(Int_t detElemId, Int_t cathod)
-{
-// Get mapping segmentation for given detection elemnt
-
- const AliMUONVGeometryDESegmentation* deSegmentation
- = GetGeometrySegmentation(cathod)->GetDESegmentation(detElemId);
-
- if (!deSegmentation) {
- AliFatal(Form("DE segmentation for detElemId= %d not defined.",
- detElemId));
- }
-
- return (const AliMpSectorSegmentation*)deSegmentation->GetMpSegmentation();
- // check if we need AliMpSectorSegmentation
-}
-
-
-//__________________________________________________________________________
-void AliMUONSt1Response::ReadCouplesOfIntRanges(const string& value,
- TList* list,
- AliMUONSt1ElectronicElement::TDescription descr)
-{
-// Decode couplets of integer ranges (enclosed within parenthesis and
-// separated by a comma, eg. (12/20,33/60) for ranges 12 to 20 and 33 to 60)
-// and save these ranges in <list>
-
- StringVector lstCpl = decoder::SplitNtuples(value);
- for (UInt_t n=0;n<lstCpl.size();n++){ // for each (..,..) couplet
- StringVector lst = decoder::SplitList(lstCpl[n],",");
- // should have 2 elements
- if (lst.size() != 2) {
- AliWarning("Bad pad definition");
- continue;
- }
- IntPairVector lst1 = decoder::DecodeListOfIntRanges(lst[0],";");
- IntPairVector lst2 = decoder::DecodeListOfIntRanges(lst[1],";");
- for (UInt_t u1=0;u1<lst1.size();u1++){
- for (UInt_t u2=0;u2<lst2.size();u2++){
- AliMUONSt1ElectronicElement* elem
- = new AliMUONSt1ElectronicElement(descr);
- fTrashList.Add(elem);
- elem->SetRange(0,lst1[u1].first,lst1[u1].second);
- elem->SetRange(1,lst2[u2].first,lst2[u2].second);
- list->Add(elem);
- }
- }
- }
-}
-
-
-//__________________________________________________________________________
-void AliMUONSt1Response::ReadCouplesOfFloatRanges(const string& value,
- TList* list)
-{
-// Decode couplets of floating point ranges (enclosed within parenthesis and
-// separated by a comma, eg. (12./20.,33./60.) for ranges 12. to 20. and 33. to 60.)
-// and save these ranges in <list>
-
- StringVector lstCpl = decoder::SplitNtuples(value);
- for (UInt_t n=0;n<lstCpl.size();n++){ // for each (..,..) couplets
- StringVector lst = decoder::SplitList(lstCpl[n],",");
- // should have 2 elements
- if (lst.size() != 2) {
- AliWarning("Bad pad definition");
- continue;
- }
- DoublePairVector lst1 = decoder::DecodeListOfFloatRanges(lst[0],";");
- DoublePairVector lst2 = decoder::DecodeListOfFloatRanges(lst[1],";");
- for (UInt_t u1=0;u1<lst1.size();u1++){
- for (UInt_t u2=0;u2<lst2.size();u2++){
- AliMUONSt1ElectronicElement* elem
- = new AliMUONSt1ElectronicElement(AliMUONSt1ElectronicElement::kXY);
- fTrashList.Add(elem);
- elem->SetRange(0,lst1[u1].first,lst1[u1].second);
- elem->SetRange(1,lst2[u2].first,lst2[u2].second);
- list->Add(elem);
- }
- }
- }
-}
-
-
-//__________________________________________________________________________
-void AliMUONSt1Response::SetPairToParam(const string& name, const string& value,
- AliMUONSt1ResponseParameter* param) const
-{
-// set a (name,value) pair to <param>
-
- TString path = fgkTopDir + fgkDataDir ;
- const char* nm = name.c_str();
- if (fgkStateName.CompareTo(nm,TString::kIgnoreCase)==0){
- param->SetState(atoi(value.c_str()));
- } else if (fgkPedestalName.CompareTo(nm,TString::kIgnoreCase)==0){
- StringVector lst = decoder::SplitList(value," ");
- if ((lst.size()>0) && (fgkNotName.CompareTo(lst[0].c_str(),TString::kIgnoreCase)==0)){
- param->UnSetPedestal();
- } else if ((lst.size()>1) && (fgkValueName.CompareTo(lst[0].c_str(),TString::kIgnoreCase)==0)){
- param->SetPedestal(atof(lst[1].c_str()));
- } else if ((lst.size()>1) && (fgkFileName.CompareTo(lst[0].c_str(),TString::kIgnoreCase)==0)){
- param->SetPedestal(path+lst[1].c_str());
- } else if ((lst.size()>2) && (fgkGausName.CompareTo(lst[0].c_str(),TString::kIgnoreCase)==0)){
- param->SetPedestal(atof(lst[1].c_str()),atof(lst[2].c_str()));
- }
- } else if (fgkNoiseName.CompareTo(nm,TString::kIgnoreCase)==0){
- StringVector lst = decoder::SplitList(value," ");
- if ((lst.size()>1) && (fgkValueName.CompareTo(lst[0].c_str(),TString::kIgnoreCase)==0)){
- param->SetNoise(atof(lst[1].c_str()));
- } else if ((lst.size()>1) && (fgkFileName.CompareTo(lst[0].c_str(),TString::kIgnoreCase)==0)){
- param->SetNoise(path+lst[1].c_str());
- } else if ((lst.size()>2) && (fgkGausName.CompareTo(lst[0].c_str(),TString::kIgnoreCase)==0)){
- param->SetNoise(atof(lst[1].c_str()),atof(lst[2].c_str()));
- }
- } else if (fgkNofSigmaName.CompareTo(nm,TString::kIgnoreCase)==0){
- param->SetNofSigma(atoi(value.c_str()));
- } else if (fgkStickyOnName.CompareTo(nm,TString::kIgnoreCase)==0){
- IntPairVector lst = decoder::DecodeListOfIntRanges(value);
- for (UInt_t i=0;i<lst.size();i++){
- for (Int_t j=lst[i].first;(j<12) && (j<=lst[i].second);j++){
- param->SetStickyBitOn(j);
- }
- }
- } else if (fgkStickyOffName.CompareTo(nm,TString::kIgnoreCase)==0){
- IntPairVector lst = decoder::DecodeListOfIntRanges(value);
- for (UInt_t i=0;i<lst.size();i++){
- for (Int_t j=lst[i].first;(j<12) && (j<=lst[i].second);j++){
- param->SetStickyBitOff(j);
- }
- }
- }
-}
-
-
-//__________________________________________________________________________
-void AliMUONSt1Response::SetPairToListElem(const string& name,
- const string& value, TList* list)
-{
-// set a (name,value) pair to <list>
-
- const char* nm = name.c_str();
- if (fgkIJName.CompareTo(nm,TString::kIgnoreCase)==0){
- ReadCouplesOfIntRanges(value,list,AliMUONSt1ElectronicElement::kIJ);
- } else if (fgkMGCName.CompareTo(nm,TString::kIgnoreCase)==0){
- ReadCouplesOfIntRanges(value,list,AliMUONSt1ElectronicElement::kMGC);
- } else if (fgkMGName.CompareTo(nm,TString::kIgnoreCase)==0){
- ReadCouplesOfIntRanges(value,list,AliMUONSt1ElectronicElement::kMG);
- } else if (fgkMName.CompareTo(nm,TString::kIgnoreCase)==0){
- IntPairVector lst = decoder::DecodeListOfIntRanges(value);
- for (UInt_t i=0;i<lst.size();i++){
- AliMUONSt1ElectronicElement* elem
- = new AliMUONSt1ElectronicElement(AliMUONSt1ElectronicElement::kM);
- fTrashList.Add(elem);
- elem->SetRange(0,lst[i].first,lst[i].second);
- list->Add(elem);
- }
- } else if (fgkXYName.CompareTo(nm,TString::kIgnoreCase)==0){
- ReadCouplesOfFloatRanges(value,list);
- }
-}
-
-
-//__________________________________________________________________________
-void AliMUONSt1Response::ReadIniFile(Int_t plane)
-{
- //Read the ini file and fill the <plane>th structures
-
- cout << "ReadIniFile now ..." << endl;
-
- TString path = fgkTopDir + fgkDataDir ;
- //read .ini file
- if (gSystem->AccessPathName(path+fIniFileName[plane],kReadPermission)){
- AliFatal(Form("Unable to Read the file %s",fIniFileName[plane].Data()));
- return;
- }
- fRegions.clear();
- fParams.clear();
- ReadIniFile(plane,path+fIniFileName[plane],kTRUE,kTRUE,kTRUE);
-}
-
-
-//__________________________________________________________________________
-void AliMUONSt1Response::ReadIniFile(Int_t plane,const TString& fileName,
- Bool_t rdParam,Bool_t rdRegion,Bool_t rdRule)
-{
- //Read the given ini file and fill the <plane>th structures
-
- cout<<"Reading parameter file "<<fileName<<endl;
- AliMUONSt1IniReader iniFile(fileName.Data());
- AliMUONSt1IniReader::Chapter chap;
- AliMUONSt1IniReader::ValueList vals;
- AliMUONSt1IniReader::ValueList::iterator itValue;
- while (!iniFile.Eof()){
- chap = iniFile.MakeCurrentChapter();
- TString chapName = chap.first.c_str();
- vals = chap.second;
- if (fgkBaseName.CompareTo(chapName,TString::kIgnoreCase)==0){
- for (itValue = vals.begin() ; itValue != vals.end(); ++itValue){
- string name = (*itValue).first;
- string value = (*itValue).second;
- if (fgkIncludeName.CompareTo(name.c_str(),TString::kIgnoreCase)==0){
- StringVector lst = decoder::SplitList(value,":");
- if (lst.size()>0){
- TString inFileName = TString(gSystem->DirName(fileName))+"/" + lst[0].c_str();
- Bool_t inParam=kFALSE,inRegion=kFALSE,inRule=kFALSE;
- if (lst.size()>1) {
- StringVector lst2 = decoder::SplitList(lst[1],",");
- for (UInt_t k=0;k<lst2.size();k++){
- if (fgkParameterName.CompareTo(lst2[k].c_str(),TString::kIgnoreCase)==0){
- inParam=kTRUE;
- } else if (fgkRegionName.CompareTo(lst2[k].c_str(),TString::kIgnoreCase)==0){
- inRegion=kTRUE;
- } else if (fgkRuleName.CompareTo(lst2[k].c_str(),TString::kIgnoreCase)==0){
- inRule=kTRUE;
- }
- }
- } else {
- inParam=inRegion=inRule=kTRUE;
- }
- ReadIniFile(plane,inFileName,inParam,inRegion,inRule);
- }
- }
- }
- } else if (rdParam && fgkParameterName.CompareTo(chapName,TString::kIgnoreCase)==0){
- AliMUONSt1ResponseParameter* param = new AliMUONSt1ResponseParameter();
- fTrashList.Add(param);
- string paramName=Form("Parameter %d",fParams.size()+1);
- for (itValue = vals.begin() ; itValue != vals.end(); ++itValue){
- string name = (*itValue).first;
- string value = (*itValue).second;
- if (fgkNameName.CompareTo(name.c_str(),TString::kIgnoreCase)==0){
- paramName=value;
- } else SetPairToParam(name,value,param);
- }
- fParams[paramName]=param;
- } else if (rdRegion && fgkRegionName.CompareTo(chapName,TString::kIgnoreCase)==0){
- TList* lstElem = new TList;
- string listName=Form("Region %d",fRegions.size()+1);
- for (itValue = vals.begin() ; itValue != vals.end(); ++itValue){
- string name = (*itValue).first;
- string value = (*itValue).second;
- if (fgkNameName.CompareTo(name.c_str(),TString::kIgnoreCase)==0){
- listName=value;
- } else SetPairToListElem(name,value,lstElem);
- }
- fRegions[listName]=lstElem;
- }
- }
- iniFile.Reset();
- while (!iniFile.Eof()){
- chap = iniFile.MakeCurrentChapter();
- TString chapName = chap.first.c_str();
- vals = chap.second;
- if (rdRule && fgkRuleName.CompareTo(chapName,TString::kIgnoreCase)==0){
- Int_t i;
- Bool_t zones[fgkNofZones];
- for (i=0;i<fgkNofZones;i++) zones[i]=kFALSE;
- AliMUONSt1ResponseRule* rule=0;
- for (itValue = vals.begin() ; itValue != vals.end(); ++itValue){
- string name = (*itValue).first;
- string value = (*itValue).second;
- if (fgkZoneName.CompareTo(name.c_str(),TString::kIgnoreCase)==0){
- IntPairVector lst = decoder::DecodeListOfIntRanges(value);
- for (UInt_t i=0;i<lst.size();i++){
- for (Int_t j=lst[i].first;(j<=fgkNofZones) && (j<=lst[i].second);j++) {
- if (j>0) zones[j-1] = kTRUE;
- }
- }
- } else if (fgkRegionName.CompareTo(name.c_str(),TString::kIgnoreCase)==0){
- ListMap::iterator it = fRegions.find(value);
- if (it != fRegions.end()){
- if (!rule) {
- rule = new AliMUONSt1ResponseRule();
- fTrashList.Add(rule);
- }
- TIter next((*it).second);
- AliMUONSt1ElectronicElement* el;
- while ((el = static_cast<AliMUONSt1ElectronicElement*>(next()))){
- rule->AddElement(el);
- }
- } else AliWarning(Form("Can't find region named %s",value.c_str()));
- }
- }
- for (itValue = vals.begin() ; itValue != vals.end(); ++itValue){
- string name = (*itValue).first;
- string value = (*itValue).second;
- if (fgkParameterName.CompareTo(name.c_str(),TString::kIgnoreCase)==0){
- ParamsMap::iterator it = fParams.find(value);
- if (it != fParams.end()){
- AliMUONSt1ResponseParameter* param = (*it).second;
- for (i=0;i<fgkNofZones;i++) if (zones[i]) {
- fDefaultParameters[plane][i]=param;
- }
- if (rule) rule->AddParameter(param);
- } else AliWarning(Form("Can't find parameter named %s",value.c_str()));
- }
- }
- if (rule) fRulesList[plane].AddFirst(rule);
- }
- }
- for (ListMap::iterator it = fRegions.begin() ; it != fRegions.end(); ++it) delete (*it).second;
-}
-
-
-//__________________________________________________________________________
-void AliMUONSt1Response::ReadFiles()
-{
-// Define the current response rules with respect to the description
-// given in the "configChamber1.ini" and "configChamber2.ini" files.
-
- Int_t i;
- TString path = fgkTopDir + fgkDataDir ;
-
- TString configFileName = path + fgkConfigBaseName + Form("%d.ini",fChamberId);
- if (gSystem->AccessPathName(configFileName,kReadPermission)){
- // no configChamberI.ini file exists
- SetIniFileName(0,fgkStandardIniFileName);
- SetIniFileName(1,fgkStandardIniFileName);
- } else {
- cout<<"Reading configuration file "<<configFileName<<endl;
- AliMUONSt1IniReader iniFile(configFileName.Data());
- while (!iniFile.Eof()) {
- iniFile.ReadNextLine();
- if (iniFile.GetCurrentType() != AliMUONSt1IniReader::kValue) continue;
- Int_t plane;
- if ((sscanf(iniFile.GetCurrentName().c_str()
- ,"file%d",&plane)==1) && (plane>=0) && (plane<=1)){
- SetIniFileName(plane,iniFile.GetCurrentValue().c_str());
- }
- }
- }
- //book memory and fill them with .ini files
- for (i=0;i<2;i++){
- ReadIniFile(i);
- }
-
- fReadFiles = kFALSE;
-}
-
-//__________________________________________________________________________
-Float_t AliMUONSt1Response::IntPH(Float_t eloss)
-{
- // Calculate charge from given ionization energy lost.
-
- Int_t nel;
- nel= Int_t(eloss*1.e9/20);
- Float_t charge=0;
- if (nel == 0) nel=1;
- for (Int_t i=1;i<=nel;i++) {
- Float_t arg=0.;
- while(!arg) arg = gRandom->Rndm();
- charge -= fChargeSlope*TMath::Log(arg);
- }
- return charge;
-}
-
-
-//__________________________________________________________________________
-AliMpZone* AliMUONSt1Response::FindZone(const AliMpSector* sector, Int_t posId) const
-{
-// to be moved to AliMpSector::
-
- for (Int_t izone=1;izone<=sector->GetNofZones();izone++){
- AliMpZone* zone = sector->GetZone(izone);
- for (Int_t isub=0;isub<zone->GetNofSubZones();isub++){
- AliMpSubZone* sub=zone->GetSubZone(isub);
- for (Int_t iseg=0;iseg<sub->GetNofRowSegments();iseg++){
- if (sub->GetRowSegment(iseg)->HasMotifPosition(posId)) return zone;
- }
- }
- }
- return 0;
-}
-
-
-//__________________________________________________________________________
-Int_t AliMUONSt1Response::DigitResponse(Int_t digit, AliMUONTransientDigit* where)
-{
- // returns the electronic response of pad located at <where>, when
- // a charge <digit> is present
-
- //cout<<"electronic of pad "<<where->PadX()<<' '<<where->PadY()
- // <<" on plane "<<where->Cathode()<<endl;
-
- //read the files the first time this function is called
- if (fReadFiles) ReadFiles();
-
- fCountNofCalls++;
-
- const AliMpSectorSegmentation* segmentation
- = GetMpSegmentation(where->DetElemId(), where->Cathode());
- const AliMpSector* sector = segmentation->GetSector();
-
- AliMpIntPair indices(where->PadX(),where->PadY());
- AliMpPad pad = segmentation->PadByIndices(indices,kFALSE);
- Int_t gc=0;
- Int_t numZone=0;
- AliMpZone* zone=0;
- cout << "Digit: DE=" << where->DetElemId()
- << " cathod=" << where->Cathode() << endl;
- cout << "Found pad: " << pad << endl;
-
- if (pad.IsValid()) {
- AliMpIntPair location = pad.GetLocation();
- //cout<<location.GetFirst()<<endl;
- Int_t posId=abs(location.GetFirst());
-/*
- AliMpSector* sector=0;
- if (fPlane[0]->GetFrontSector()->GetMotifMap()->FindMotifPosition(posId))
- sector=(AliMpSector*)fPlane[0]->GetFrontSector();
- else if (fPlane[0]->GetBackSector()->GetMotifMap()->FindMotifPosition(posId))
- sector=(AliMpSector*)fPlane[0]->GetBackSector();
-*/
- if (sector) zone=FindZone(sector,posId);
- if (zone){
- numZone=zone->GetID()-1;
- gc=location.GetSecond();
- } else {
- fCountUnknownZone++;
- }
- } else {
- fCountUnknownIndices++;
- }
-
- cout << "Zone: " << zone << endl;
-
- if (!zone) {
- cout<<"Probleme electronic of pad "<<where->PadX()<<' '<<where->PadY()
- <<" on plane "<<where->Cathode()<<endl;
- return 6666;
- }
- cout << "Loop1: " << endl;
- TList listParams;
- TIter next(&fRulesList[where->Cathode()-1]);
- AliMUONSt1ResponseRule* rule;
- while ( (rule = static_cast<AliMUONSt1ResponseRule*>(next())))
- if (rule->Contains(pad)) listParams.AddAll(rule->GetParameters());
- if (fDefaultParameters[where->Cathode()-1][numZone])
- listParams.Add(fDefaultParameters[where->Cathode()-1][numZone]);
-
- cout << "Loop2: " << endl;
- AliMUONSt1ResponseParameter* param;
- TIter nextParam(&listParams);
- while ( (param = static_cast<AliMUONSt1ResponseParameter*>(nextParam()))){
- if (param->GetState()==kFALSE) {
- return 0;
- }
- }
- cout << "Loop3: " << endl;
- nextParam.Reset();
- while ( (param = static_cast<AliMUONSt1ResponseParameter*>(nextParam()))){
- if (param->HasPedestal()) {
- digit = param->ApplyPedestal(digit,gc);
- break; // Apply pedestals just once --> break the loop once a pedestal
-// rule is applied
- }
- }
- if ( digit < 0) digit=0;
- if (digit > MaxAdc()) digit=MaxAdc();
- nextParam.Reset();
- while ( (param = static_cast<AliMUONSt1ResponseParameter*>(nextParam()))){
- digit = param->ApplyStickyBits(digit);
- }
-
- //cout<<digit<<endl;
- return digit;
-}
-
-
-//__________________________________________________________________________
-void AliMUONSt1Response::PrintStatistics() const
-{
-// Show the results of the statistics
-
- cout<<"The DigitResponse() method was called "<<fCountNofCalls<<" times"<<endl;
- cout<<" it was unable to find the pad corresponding to the given indices "
- <<fCountUnknownIndices<<" times ("
- <<(Double_t)100.*fCountUnknownIndices/fCountNofCalls
- <<"%)"<<endl;
- cout<<" it was unable to find the zone corresponding to the found pad "
- <<fCountUnknownZone<<" times ("
- <<(Double_t)100.*fCountUnknownZone/fCountNofCalls
- <<"%)"<<endl;
-}
-
-
-
-
-
-
-
+++ /dev/null
-#ifndef ALI_MUON_ST1_RESPONSE_H
-#define ALI_MUON_ST1_RESPONSE_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-// Revision of includes 07/05/2004
-
-/// \ingroup sim
-/// \class AliMUONSt1Response
-/// \brief Detailed response class for station 1
-///
-/// Response class for station 1 including electronics and detector response.
-/// Individual pedestals or noise levels can be controlled separately.
-/// The current pulse height responses do not contain any physics
-///
-/// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-
-#include <map>
-#include <string>
-#ifndef __HP_aCC
-using std::map;
-using std::string;
-#endif
-
-#include <TString.h>
-#include <TList.h>
-
-#include "AliMUONResponseV0.h"
-#include "AliMUONSt1ElectronicElement.h"
-
-class AliMpSector;
-class AliMpSectorSegmentation;
-class AliMpZone;
-class AliMpSector;
-class TArrayF;
-class TObjArray;
-class AliMUONSt1ResponseParameter;
-//class AliMUONChamber;
-
-class AliMUONSt1Response : public AliMUONResponseV0
-{
- public:
- AliMUONSt1Response(Int_t chamberId);
- AliMUONSt1Response();
- virtual ~AliMUONSt1Response();
-
- //
- // Configuration methods
- //
- void SetIniFileName(Int_t plane,const TString& fileName);
-
- virtual Float_t IntPH(Float_t eloss);
-
- // Noise, zero-suppression, adc saturation
- virtual Int_t DigitResponse(Int_t digit,AliMUONTransientDigit* where);
- void PrintStatistics() const;
-
- protected:
- AliMUONSt1Response(const AliMUONSt1Response& rhs);
-
- // operators
- AliMUONSt1Response& operator=(const AliMUONSt1Response & rhs);
-
- private:
- // typedefs
- typedef map<string, AliMUONSt1ResponseParameter*> ParamsMap;
- typedef map<string, TList*> ListMap;
-
- // private methods
- const AliMUONGeometrySegmentation* GetGeometrySegmentation(Int_t cathod);
- const AliMpSectorSegmentation* GetMpSegmentation(Int_t detElemId, Int_t cathod);
- const AliMpSector* GetMpSector(Int_t detElemId, Int_t cathod);
- AliMpZone* FindZone(const AliMpSector* sector,Int_t posId) const; // to be moved in AliMpSector::
- void ReadFiles();
- void ReadIniFile(Int_t plane,const TString& fileName,Bool_t rdParam,Bool_t rdRegion,Bool_t rdRule);
- void ReadIniFile(Int_t plane);
- void ReadCouplesOfIntRanges(const string& value,TList* list,AliMUONSt1ElectronicElement::TDescription descr);
- void ReadCouplesOfFloatRanges(const string& value,TList* list);
- void SetPairToParam(const string& name,const string& value,AliMUONSt1ResponseParameter* param) const;
- void SetPairToListElem(const string& name,const string& value,TList* list);
-
- // private constants
- static const Int_t fgkNofZones=4; // number of zones
- static const TString fgkTopDir; // top directory path
- static const TString fgkDataDir; // data directory path
- static const TString fgkConfigBaseName; // config file base name
- static const TString fgkStandardIniFileName;// standard ini file name
-
- // static names
- static const TString fgkBaseName ; // base name
- static const TString fgkIncludeName ; // include name
- static const TString fgkParameterName ; // parameter name
- static const TString fgkRegionName ; // region name
- static const TString fgkRuleName ; // rule name
- static const TString fgkNameName ; // name name
- static const TString fgkPedestalName ; // pedestal name
- static const TString fgkNoiseName ; // noise name
- static const TString fgkStateName ; // state name
- static const TString fgkMName ; // M name
- static const TString fgkMGName ; // MG name
- static const TString fgkMGCName ; // MGC name
- static const TString fgkIJName ; // i,j name
- static const TString fgkXYName ; // x,y name
- static const TString fgkZoneName ; // zone name
- static const TString fgkStickyOnName ; // sticky on name
- static const TString fgkStickyOffName ; // sticky off
- static const TString fgkFileName ; // file name
- static const TString fgkValueName ; // value name
- static const TString fgkGausName ; // gauss name
- static const TString fgkNotName ; // not name
- static const TString fgkNofSigmaName ; // nof sigma name
-
- // data members
- TString fIniFileName[2];// file names for initialisation of each cathode
- Bool_t fReadFiles; // flag to read initalization files only once
-
- AliMUONSt1ResponseParameter* fDefaultParameters[2][fgkNofZones]; // !Response for each zone
- TList fRulesList[2]; //! list of special rules
-
- Int_t fCountNofCalls; // number of calls to DigitResponse()
- Int_t fCountUnknownZone; // ntimes the DigitResponse was called in an unknown zone
- Int_t fCountUnknownIndices; // ntimes the DigitResponse was called with unknown indices
-
- Int_t fChamberId; // The MUON chamber Id
-
- ParamsMap fParams; //! internal parameter list
- ListMap fRegions; //! internal list of regions
- TList fTrashList; //! internal trash list
-
- ClassDef(AliMUONSt1Response,1) // Overall detector response
-};
-
-#endif //ALI_MUON_ST1_RESPONSE_H
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-
-// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-//
-// Class AliMUONSt1ResponseParameter
-// ---------------------------------
-// Describes a set of filters to be applied to a digital value
-// in order to simulate electronics characteristics
-// (pedestal, noise, sticky bits, etc....)
-// Threshold levels for the MANU zero supression algorithm are included.
-// Included in AliRoot 2003/01/28
-
-#include <fstream>
-
-#include <TRandom.h>
-#include <TString.h>
-
-#include "AliMUONSt1ResponseParameter.h"
-#include "AliLog.h"
-
-ClassImp(AliMUONSt1ResponseParameter)
-
-//_________________________________________________________________________
-AliMUONSt1ResponseParameter::AliMUONSt1ResponseParameter()
- :TNamed()
-{
-// default constructor
- fPedestalMode = kNone;
- fNoiseMode = kNone;
- fState=1;
- fNofSigma=3;
- fStickyOn=fStickyOff=0;
-}
-
-//_________________________________________________________________________
-AliMUONSt1ResponseParameter::AliMUONSt1ResponseParameter(const TString& name,const TString& title)
-:TNamed(name,title)
-{
-// normal constructor
- fPedestalMode = kNone;
- fNoiseMode = kNone;
- fState=1;
- fNofSigma=3;
- fStickyOn=fStickyOff=0;
-}
-
-//_________________________________________________________________________
-AliMUONSt1ResponseParameter::~AliMUONSt1ResponseParameter()
-{
-// destructor
-}
-
-//_________________________________________________________________________
-void AliMUONSt1ResponseParameter::SetState(Bool_t state)
-{
-// If set to off, no information will be available from the electronics
-// ---
-
- fState=state;
-}
-
-//_________________________________________________________________________
-void AliMUONSt1ResponseParameter::SetPedestal(Double_t val)
-{
-// Set pedestal values to a constant
-// ---
-
- fPedestalMode = kValue;
- fPedestalParam.value = val;
-}
-
-//_________________________________________________________________________
-void AliMUONSt1ResponseParameter::SetPedestal(Double_t mean,Double_t sigma)
-{
-// Set pedestal values to a parameterized gaussian
-// ---
-
- fPedestalMode = kGauss;
- fPedestalParam.gauss.mean = mean;
- fPedestalParam.gauss.sigma = sigma;
-}
-//_________________________________________________________________________
-void AliMUONSt1ResponseParameter::SetPedestal(const TString& fileName)
-{
-// Set pedestal values to those given in a file
-// ---
-
- ifstream file(fileName.Data());
- if (file.good()){
- fPedestalMode = kFile;
- for (Int_t ch=0;ch<fgkNofChannels;ch++) {
- Float_t value;
- file>>value;
- fPedestalParam.values[ch] = value;
- //cout<<"Pedestal["<<i<<"]["<<ch<<"]="<<value<<endl;
- }
- file.close();
- } else {
- AliWarning(Form("Can't read file %s",fileName.Data()));
- SetPedestal(150.,10.);
- }
-}
-
-//_________________________________________________________________________
-void AliMUONSt1ResponseParameter::UnSetPedestal()
-{
-// Set pedestal values to 0.
-// ---
-
- fPedestalMode=kNone;
-}
-
-//_________________________________________________________________________
-void AliMUONSt1ResponseParameter::SetNoise(Double_t val)
-{
-// Set Noise values to a constant value
-// ---
-
- fNoiseMode = kValue;
- fNoiseParam.value = val;
-}
-
-//_________________________________________________________________________
-void AliMUONSt1ResponseParameter::SetNoise(Double_t mean,Double_t sigma)
-{
-// Set Noise values to a parameterized gaussian
-// ---
-
- fNoiseMode = kGauss;
- fNoiseParam.gauss.mean = mean;
- fNoiseParam.gauss.sigma = sigma;
-}
-
-//_________________________________________________________________________
-void AliMUONSt1ResponseParameter::SetNoise(const TString& fileName)
-{
-// Set Noise values to those given in a file
-// ---
-
- ifstream file(fileName.Data());
- if (file.good()){
- fNoiseMode = kFile;
- for (Int_t ch=0;ch<fgkNofChannels;ch++) {
- Float_t value;
- file>>value;
- fNoiseParam.values[ch] = value;
- //cout<<"Noise["<<i<<"]["<<ch<<"]="<<value<<endl;
- }
- file.close();
- } else {
- AliWarning(Form("Can't read file %s",fileName.Data()));
- SetNoise(150.,10.);
- }
-}
-
-//_________________________________________________________________________
-void AliMUONSt1ResponseParameter::SetNofSigma(Int_t nofSigma)
-{
-// set Number of sigmas to be applied as threshold (for zero suppression)
-// ---
-
- fNofSigma = nofSigma;
-}
-
-//_________________________________________________________________________
-void AliMUONSt1ResponseParameter::SetStickyBitOn (Int_t bit,Int_t val)
-{
-// In the response, this bit will always be set to 1 (unless <State> is off)
-// ---
-
- if (val)
- fStickyOn |= (1<<bit);
- else
- fStickyOn &= ~(1<<bit);
-}
-
-//_________________________________________________________________________
-void AliMUONSt1ResponseParameter::SetStickyBitOff(Int_t bit,Int_t val)
-{
-// In the response, this bit will always be set to 0
-// ---
-
- if (val)
- fStickyOff |= (1<<bit);
- else
- fStickyOff &= ~(1<<bit);
-}
-
-//_________________________________________________________________________
-Int_t AliMUONSt1ResponseParameter::ApplyPedestal(Int_t base,Int_t GC) const
-{
-// calculate the response to <base>, with respect to the current pedestal
-// parameters
-// --
- Double_t ped = Choose(fPedestalMode,fPedestalParam,GC);
- Double_t nse = Choose(fNoiseMode,fNoiseParam,GC);
- Double_t noise = gRandom->Gaus(0, nse);
- base+=(Int_t)(noise + ped);
- if (base-ped-noise*fNofSigma<0) base=0;
-
- return base;
-}
-//_________________________________________________________________________
-Int_t AliMUONSt1ResponseParameter::ApplyStickyBits(Int_t base) const
-{
-// set the response to <base>, with respect to the current stickyBits
-// parameters
-// --
- base |= fStickyOn;
- base &= (~fStickyOff);
- return base;
-}
-//////////////////// Privates methods
-//_________________________________________________________________________
-
-Double_t AliMUONSt1ResponseParameter::Choose(TMode mode,TParam param,Int_t GC) const
-{
-// Choose a (pedestal/noise) value to be applied following the parameterization rule
-// ---
-
- switch (mode){
- case kNone : return 0;
- case kValue : return param.value;
- case kGauss : return gRandom->Gaus(param.gauss.mean,param.gauss.sigma);
- case kFile : return param.values[GC];
- }
- AliFatal("No mode is given");
- return 0;
-}
+++ /dev/null
-#ifndef ALI_MUON_ST1_RESPONSE_PARAMETER_H
-#define ALI_MUON_ST1_RESPONSE_PARAMETER_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-// Revision of includes 07/05/2004
-
-/// \ingroup sim
-/// \class AliMUONSt1ResponseParameter
-/// \brief Describes a set of filters to be applied to a digital value
-///
-/// Describes a set of filters to be applied to a digital value
-/// in order to simulate electronics characteristics
-/// (pedestal, noise, sticky bits, etc....)
-/// Threshold levels for the MANU zero supression algorithm are included.
-///
-/// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-
-#include <TNamed.h>
-
-class TString;
-
-class AliMUONSt1ResponseParameter : public TNamed
-{
- public:
- typedef enum {kNone,kValue,kGauss,kFile} TMode;
- typedef struct {Double_t mean; Double_t sigma;} TGaussParam;
-
- public:
- AliMUONSt1ResponseParameter();
- AliMUONSt1ResponseParameter(const TString& name,const TString& title);
- virtual ~AliMUONSt1ResponseParameter();
-
- void SetState(Bool_t state) ;
- void SetPedestal(Double_t val);
- void SetPedestal(Double_t mean,Double_t sigma);
- void SetPedestal(const TString& fileName);
- void UnSetPedestal();
- void SetNoise(Double_t val);
- void SetNoise(Double_t mean,Double_t sigma);
- void SetNoise(const TString& fileName);
- void SetNofSigma(Int_t nofSigma);
- void SetStickyBitOn (Int_t bit,Int_t val=1);
- void SetStickyBitOff(Int_t bit,Int_t val=1);
- Int_t ApplyPedestal(Int_t base,Int_t GC) const;
- Int_t ApplyStickyBits(Int_t base) const;
- Bool_t HasPedestal() const {return fPedestalMode != kNone;}
- Bool_t GetState() const {return fState;}
-
- private:
- static const Int_t fgkNofChannels=64; // number of channels
- typedef union {
- //Double_t values[fgkNofChannels];
- Double_t values[64];
- Double_t value;
- TGaussParam gauss;
- } TParam;
-
- Double_t Choose(TMode mode,TParam param,Int_t GC) const;
- TMode fPedestalMode; // mode for pedestal values
- TParam fPedestalParam; // pedestal access parameters
- TMode fNoiseMode; // mode for noise values
- TParam fNoiseParam; // noise access parameters
- Int_t fNofSigma; // No of sigma for threshold (zero supression)
- Bool_t fState; // is the element on/off
- Int_t fStickyOn; // which bits are always on (mask) .
- Int_t fStickyOff; // which bits are always off (mask).
-
- ClassDef(AliMUONSt1ResponseParameter,1) // electronics parmeters for Response
-};
-#endif //ALI_MUON_ST1_RESPONSE_PARAMETER_H
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-
-// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-//
-// Class AliMUONSt1ResponseRule
-// -----------------------------
-// Describes a response rule.
-// A "rule" is defined as being a set of electronic filters to be applied
-// (ie. a set of AliMUONSt1ResponseParameter) and a set of cathode pads to
-// which these filters should be applied (set of AliMUONSt1ElectronicElement)
-// Included in AliRoot 2003/01/28
-
-#include "AliMpPad.h"
-
-#include "AliMUONSt1ResponseRule.h"
-#include "AliMUONSt1ElectronicElement.h"
-#include "AliMUONSt1ResponseParameter.h"
-ClassImp(AliMUONSt1ResponseRule)
-
-//__________________________________________________________________________
-AliMUONSt1ResponseRule::AliMUONSt1ResponseRule()
- : TObject(),
- fElementList(),
- fParameters()
-{
-// default constructor
-}
-
-//__________________________________________________________________________
-AliMUONSt1ResponseRule::~AliMUONSt1ResponseRule()
-{
-// destructor
-}
-
-//__________________________________________________________________________
-void AliMUONSt1ResponseRule::AddElement(AliMUONSt1ElectronicElement* element)
-{
-// Add an electronic element to the list
-// ---
-
- fElementList.Add(element);
-}
-
-//__________________________________________________________________________
-void AliMUONSt1ResponseRule::AddParameter(AliMUONSt1ResponseParameter* param)
-{
-// Add an electronics parameter for this rule
-// ---
-
- fParameters.Add(param);
-}
-
-//__________________________________________________________________________
-Bool_t AliMUONSt1ResponseRule::Contains(const AliMpPad& pad) const
-{
-// Is this pad is contained in this rule's list
-// ---
-
- TIter next(&fElementList);
- AliMUONSt1ElectronicElement* el;
- while ((el = static_cast<AliMUONSt1ElectronicElement*>(next()))){
- if (el->Contains(pad)) return kTRUE;
- }
- return kFALSE;
-}
+++ /dev/null
-#ifndef ALI_MUON_ST1_RESPONSE_RULE_H
-#define ALI_MUON_ST1_RESPONSE_RULE_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-// Revision of includes 07/05/2004
-
-/// \ingroup sim
-/// \class AliMUONSt1ResponseRule
-/// \brief Describes a response rule
-///
-/// Describes a response rule.
-/// A "rule" is defined as being a set of electronic filters to be applied
-/// (ie. a set of AliMUONSt1ResponseParameter) and a set of cathode pads to
-/// which these filters should be applied (set of AliMUONSt1ElectronicElement)
-///
-/// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-
-#include <TObject.h>
-#include <TList.h>
-
-class AliMpPad;
-
-class AliMUONSt1ElectronicElement;
-class AliMUONSt1ResponseParameter;
-
-class AliMUONSt1ResponseRule : public TObject
-{
- public:
- AliMUONSt1ResponseRule();
- virtual ~AliMUONSt1ResponseRule();
-
- void AddElement(AliMUONSt1ElectronicElement* element);
- void AddParameter(AliMUONSt1ResponseParameter* param);
- Bool_t Contains(const AliMpPad& pad) const;
- TList* GetParameters() {return &fParameters;}
-
- private:
- TList fElementList;// list of electronic elements to which this rule is applied
- TList fParameters; // parameters for this rule
-
- ClassDef(AliMUONSt1ResponseRule,1) // A set of electronic elements and the linked electronic parameters
-};
-
-#endif //ALI_MUON_ST1_RESPONSE_RULE_H
+++ /dev/null
-#ifndef ALI_MUON_ST1_TYPES_H
-#define ALI_MUON_ST1_TYPES_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-// AliMUONSt1Types
-// ---------------
-// System dependent types definitions for MUON Station1.
-//
-// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-//
-
-#include <string>
-#include <map>
-#include <vector>
-#include <fstream>
-
-#include "AliMUONSt1Containers.h"
-#include "AliMUONSt1SpecialMotif.h"
-
-class TString;
-class AliMUONSt1ResponseParameter;
-
-#ifdef __HP_aCC
- typedef vector<Int_t> IntVector;
- typedef map<Int_t , AliMUONSt1SpecialMotif> TSpecialMap;
- typedef map<string,AliMUONSt1ResponseParameter*> TParamsMap;
- typedef map<string,TList*> TListMap;
-#else
- using std::string;
- using std::vector;
- using std::multimap;
- using std::pair;
-
- typedef std::vector<Int_t> IntVector;
- typedef std::map<Int_t , AliMUONSt1SpecialMotif> TSpecialMap;
- typedef std::map<std::string,AliMUONSt1ResponseParameter*> TParamsMap;
- typedef std::map<std::string,TList*> TListMap;
-#endif
-
-#ifdef ST1_WITH_STL
- #include <map>
- #ifdef __HP_aCC
- using std::map;
- #endif
-#endif
-
-#ifdef ST1_WITH_ROOT
- #include "TExMap.h"
-#endif
-
-#ifdef ST1_WITH_STL
- typedef map<Int_t , AliMUONSt1SpecialMotif> SpecialMap;
-#endif
-#ifdef ST1_WITH_ROOT
- typedef TExMap SpecialMap;
-#endif
-
-#endif //ALI_MUON_ST1_TYPES_H
+++ /dev/null
-enum gentype_t {hijing, gun, box, pythia, param, cocktail, fluka, halo, ntuple, scan, doublescan, hijing_g};
-
-gentype_t gentype=param;
-// Int_t ntracks=6407;
-// Int_t ntracks=12000;
-// Int_t ntracks=28380;
-// Int_t ntracks=19900;
-Int_t ntracks=1;
-
-void Config()
-
-{
-// Load geant321 library
- gSystem->Load("libgeant321");
-
- new TGeant3("C++ Interface to Geant3");
-
-//=======================================================================
-// Create the output file
-
- TFile *rootfile = new TFile("galice.root","recreate");
- rootfile->SetCompressionLevel(2);
- TGeant3 *geant3 = (TGeant3*)gMC;
- AliDecayer* decayer = new AliDecayerPythia();
- decayer->SetForceDecay(kAll);
- decayer->Init();
- gMC->SetExternalDecayer(decayer);
-
-//=======================================================================
-// ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
-geant3->SetTRIG(1); //Number of events to be processed
-geant3->SetSWIT(4,100);
-geant3->SetDEBU(0,0,1);
-geant3->SetDCAY(1);
-geant3->SetPAIR(1);
-geant3->SetCOMP(1);
-geant3->SetPHOT(1);
-geant3->SetPFIS(0);
-geant3->SetDRAY(0);
-geant3->SetANNI(1);
-geant3->SetBREM(1);
-geant3->SetMUNU(1);
-geant3->SetCKOV(0);
-geant3->SetHADR(4); //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3)
-geant3->SetLOSS(1);
-geant3->SetMULS(1);
-geant3->SetRAYL(0);
-geant3->SetAUTO(1); //Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0)
-geant3->SetABAN(1); //Restore 3.16 behaviour for abandoned tracks
-geant3->SetOPTI(2); //Select optimisation level for GEANT geometry searches (0,1,2)
-Float_t cut = 1.e-4; // 100MeV cut by default
-Float_t tofmax = 1.e10;
-// GAM ELEC NHAD CHAD MUON EBREM MUHAB EDEL MUDEL MUPA TOFMAX
-geant3->SetCUTS(1.e-4, 1.e-4, 1.e-3, 1.e-4, 1.e-3, cut, cut, cut, cut, cut, 1.e-5);
-
-gAlice->TrackingLimits(700, 2000);
-
-//
-//=======================================================================
-// ************* STEERING parameters FOR ALICE SIMULATION **************
-// --- Specify event type to be tracked through the ALICE setup
-// --- All positions are in cm, angles in degrees, and P and E in GeV
-
- switch(gentype)
- {
- case gun:
-//*********************************************
-// Example for Fixed Particle Gun *
-//*********************************************
- AliGenFixed *gener = new AliGenFixed(ntracks);
- gener->SetMomentum(20);
- gener->SetPhiRange(0);
- gener->SetThetaRange(0.);
- gener->SetOrigin(30,30,500); //vertex position
- gener->SetPart(kMuonMinus); //GEANT particle type
- break;
- case box:
-//*********************************************
-// Example for Moving Particle Gun *
-//*********************************************
- AliGenBox *gener = new AliGenBox(ntracks);
- gener->SetMomentumRange(33,34);
- gener->SetPhiRange(-180,180);
- gener->SetThetaRange(2., 9.);
- gener->SetOrigin(0,0,0);
- gener->SetVertexSmear(kPerTrack);
- //vertex position
- gener->SetSigma(0, 0, 0); // Sigma in (X,Y,Z) (cm) on IP position
- gener->SetPart(kMuonPlus); // GEANT particle type
- break;
- case scan:
-//*********************************************
-// Scanning on a grid *
-//*********************************************
- AliGenScan *gener = new AliGenScan(-1);
- gener->SetMomentumRange(20,20);
- gener->SetPhiRange(0,0);
- gener->SetThetaRange(0,0);
- //vertex position
-// gener->SetSigma(1,1,0); //Sigma in (X,Y,Z) (cm) on IP position
- gener->SetPart(kMuonPlus);
- gener->SetRange(30, -100., 100., 30, -100., 100., 1, 500, 500);
- break;
- case doublescan:
-//*********************************************
-// Scanning on a grid *
-//*********************************************
- AliGenDoubleScan *gener = new AliGenDoubleScan(-1);
- gener->SetMomentumRange(4,4);
- gener->SetPhiRange(0,360);
- gener->SetThetaRange(0,0);
- //vertex position
- gener->SetSigma(3,3,0); //Sigma in (X,Y,Z) (cm) on IP position
- gener->SetPart(8);
- gener->SetRange(20, -100, 100, 20, -100, 100, 1, 500, 500);
- gener->SetDistance(1);
- break;
-
- case hijing:
- AliGenHIJINGpara *gener = new AliGenHIJINGpara(ntracks);
- gener->SetMomentumRange(0,999);
- gener->SetPtRange(0,999);
- gener->SetPhiRange(0,360);
-// gener->SetThetaRange(0.104,33.52);
- gener->SetThetaRange(0.104,90.0);
-// gener->SetThetaRange(2.,9.);
- gener->SetOrigin(0., 0.0 ,0); // vertex position
- gener->SetSigma(0,0,5.3); // Sigma in (X,Y,Z) (cm) on IP position
- gener->SetVertexSmear(kPerTrack);
- gener->SetTrackingFlag(0);
- break;
- case hijing_g:
- AliGenHijing *gener = new AliGenHijing(-1);
-
- gener->SetEnergyCMS(5600.);
- gener->SetReferenceFrame("CMS");
- gener->SetProjectile("A", 208, 82);
- gener->SetTarget ("A", 208, 82);
- gener->SetImpactParameterRange(0, 5.);
- gener->SetEvaluate(0);
- gener->KeepFullEvent();
- gener->SetJetQuenching(1);
- gener->SetShadowing(1);
- gener->SetDecaysOff(1);
- gener->SetTrigger(0);
- gener->SetSelectAll(1);
- gener->SetMomentumRange(0,9999);
- gener->SetPhiRange(-180,180);
- gener->SetThetaRange(0.104,90.0);
-// gener->SetFlavor(4);
- gener->SetOrigin(0., 0.0 ,0);
- gener->SetSigma(0,0,5.3);
- gener->SetVertexSmear(kPerEvent);
- gener->SetTrackingFlag(0);
-
- break;
-
- case pythia:
-//********************************************
-// Example for Charm Production with Pythia *
-//********************************************
-AliGenPythia *gener = new AliGenPythia(ntracks);
- gener->SetMomentumRange(0,999);
- gener->SetPhiRange(0,360);
- gener->SetThetaRange(0., 180.);
- gener->SetYRange(-10,10);
- gener->SetPtRange(0,100);
- //gener->SetOrigin(0,0,0); // vertex position
- //gener->SetVertexSmear(kPerEvent);
- //gener->SetSigma(0,0,5.6); // Sigma in (X,Y,Z) (cm) on IP
-position
- gener->SetStrucFunc(kDO_Set_1);
- gener->SetProcess(kPyCharm);
- gener->SetEnergyCMS(5500.);
- break;
-/*
- AliGenPythia *gener = new AliGenPythia(ntracks);
- gener->SetMomentumRange(0,999);
- gener->SetPhiRange(0,360);
- gener->SetThetaRange(0., 180.);
- gener->SetYRange(-10,10);
- gener->SetPtRange(0,100);
- gener->SetOrigin(0,0,0); // vertex position
- gener->SetVertexSmear(kPerEvent);
- gener->SetSigma(0,0,5.6); // Sigma in (X,Y,Z) (cm) on IP position
- gener->SetStrucFunc(DO_Set_1);
- gener->SetProcess(charm);
- gener->SetForceDecay(dimuon);
- gener->SetEnergyCMS(5500.);
- gener->SetTrackingFlag(0);
-
- break;
- */
- case param:
-//*******************************************************
-// Example for J/psi or Upsilon Production from Parameterisation *
-//*******************************************************
- AliGenParam *gener = new AliGenParam(ntracks, AliGenMUONlib::kUpsilon);
- gener->SetMomentumRange(0,999);
- gener->SetPtRange(0,999);
- gener->SetPhiRange(-180, 180);
- gener->SetYRange(2.5,9);
- gener->SetCutOnChild(1);
- gener->SetChildThetaRange(2.0,9);
- gener->SetOrigin(0,0,0); //vertex position
- gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
- gener->SetForceDecay(kDiMuon);
- gener->SetTrackingFlag(1);
-
- break;
-
-
- case fluka:
-//*******************************************************
-// Example for a FLUKA Boundary Source *
-//*******************************************************
- AliGenFLUKAsource *gener = new AliGenFLUKAsource(-1);
- gener->AddFile("$(ALICE_ROOT)/data/alice.root");
- rootfile->cd();
- gener->SetPartFlag(7);
- gener->SetMomentumRange(0,999);
- gener->SetPhiRange(0,360);
- gener->SetThetaRange(0., 180.);
- gener->SetAgeMax(1.e-5);
-
-// 31.7 events
- gener->SetFraction(1.);
- break;
-
- case ntuple:
-//*******************************************************
-// Example for reading from a external file *
-//*******************************************************
- AliGenExtFileCH *gener = new AliGenExtFileCH(-1);
- gener->SetFileName("$(ALICE_ROOT)/data/pbpb.root");
- gener->SetThetaRange(0.104,90.);
- gener->SetOrigin(0,0,0); //vertex position
- gener->SetSigma(0,0,5.6); //Sigma in (X,Y,Z) (cm) on IP position
- gener->SetVertexSmear(kPerTrack);
- gener->SetTrackingFlag(1);
- break;
-
- case halo:
-//*******************************************************
-// Example for Tunnel Halo Source *
-//*******************************************************
- AliGenHalo *gener = new AliGenHalo(ntracks);
- gener->SetFileName("/h1/morsch/marsip/marsip5.mu");
- break;
-
- case cocktail:
-//*******************************************************
-// Example for a Cocktail *
-//*******************************************************
- AliGenCocktail *gener = new AliGenCocktail();
- gener->SetMomentumRange(0,10);
- gener->SetPhiRange(0,360);
- gener->SetThetaRange(2.,9.);
- gener->SetTrackingFlag(0);
- AliGenParam *Pi0 = new AliGenParam(100, new AliGenPMDlib(), AliGenPMDlib::kPion);
- AliGenParam *Eta = new AliGenParam( 10, new AliGenPMDlib(), AliGenPMDlib::kEta);
- gener->AddGenerator(Pi0, "neutral pions" , 1.);
- gener->AddGenerator(Eta, "neutral etas" , 1.);
- break;
- }
-
-
-gener->Init();
-if (gentype==param) {
- gAlice->SetField(2,1); //Specify maximum magnetic field in Tesla (neg. ==> default field)
-}
-else {
- gAlice->SetField(0,2); // No magnetic field
-}
-
-
-Int_t iFRAME =0;
-Int_t iMAG =0;
-Int_t iITS =0;
-Int_t iABSO =1;
-Int_t iDIPO =1;
-Int_t iHALL =0;
-Int_t iSHIL =1;
-Int_t iPIPE =0;
-Int_t iFMD =0;
-Int_t iMUON =1;
-
-//=================== Alice BODY parameters =============================
-AliBODY *BODY = new AliBODY("BODY","Alice envelop");
-
-if(iFRAME) {
-//=================== FRAME parameters ============================
-AliFRAME *FRAME = new AliFRAMEv0("FRAME","Space Frame");
-}
-
-if(iMAG) {
-//=================== MAG parameters ============================
-// --- Start with Magnet since detector layouts may be depending ---
-// --- on the selected Magnet dimensions ---
-AliMAG *MAG = new AliMAG("MAG","Magnet");
-}
-
-if(iABSO) {
-//=================== ABSO parameters ============================
- AliABSO *ABSO = new AliABSOv0("ABSO","Muon Absorber");
-}
-
-if(iDIPO) {
-//=================== DIPO parameters ============================
-
- AliDIPO *DIPO = new AliDIPOv2("DIPO","Dipole version 2");
-}
-
-if(iHALL) {
-//=================== HALL parameters ============================
- AliHALL *HALL = new AliHALL("HALL","Alice Hall");
-}
-
-
-
-if(iSHIL) {
-//=================== SHIL parameters ============================
-// AliSHIL *SHIL = new AliSAROV("SHIL","Shielding");
- AliSHILvF *SHIL = new AliSHILvF("SHIL","Shielding");
- SHIL->SetPbCone(1);
-// AliSAROV *SHIL = new AliSAROV("SHIL","Shielding");
-}
-
-
-if(iPIPE) {
-//=================== PIPE parameters ============================
- AliPIPE *PIPE = new AliPIPEv0("PIPE","Beam Pipe");
-}
-
-
-if(iFMD) {
-//=================== FMD parameters ============================
- AliFMD *FMD = new AliFMDv1("FMD","normal FMD");
-}
-
-if(iMUON) {
-//=================== MUON parameters ===========================
-//
-// Parameters for selection MUON station 1 configuration:
-// detectorVersion:
-// 0: AliMUONv1.cxx
-// 2: AliMUONv2.cxx (detailed geometry for station 1)
-//
-// responseVersion:
-// 0: AliMUONResponseV0
-// 2: AliMUONSt1Response
-//
-// segmentationVersion:
-// 0: AliMUONSegmentationV01
-// 2: AliMUONSt1Segmentation
-
- Int_t detectorVersion = 2;
- Int_t responseVersion = 2;
- Int_t segmentationVersion = 2;
-
- // MUON detector
- //
- AliMUON *MUON = 0;
- if (detectorVersion == 2) {
- MUON= new AliMUONv2("MUON","normal MUON");
- }
- else {
- MUON= new AliMUONv1("MUON","normal MUON");
- }
- MUON->SetIshunt(0);
- MUON->SetMaxStepGas(0.1);
- MUON->SetMaxStepAlu(0.1);
-
- // Response
- //
- AliMUONResponse* responseChamber1;
- AliMUONResponse* responseChamber2;
-
- if (responseVersion == 2) {
- AliMUONSt1Response* responseCh1 = new AliMUONSt1Response(1);
- responseCh1->SetSqrtKx3AndDeriveKx2Kx4(0.7000); // sqrt(0.4900)
- responseCh1->SetSqrtKy3AndDeriveKy2Ky4(0.7550); // sqrt(0.5700)
- responseCh1->SetPitch(0.20); // anode-cathode distance
- responseCh1->SetSigmaIntegration(10.);
- // Mathieson parameters from L.Kharmandarian's thesis, page 190
- responseCh1->SetChargeSlope(62.5); //(62.5);
- // ChargeSlope larger to compensate for the smaller anode-cathode distance
- // and keep the same most probable ADC channel for mip's
- responseCh1->SetChargeSpread(0.144, 0.144);
- // assumed proportionality to anode-cathode distance for ChargeSpread
- responseCh1->SetMaxAdc(4095);
- responseCh1->SetZeroSuppression(3);
- responseChamber1 = responseCh1;
-
- AliMUONSt1Response* responseCh2 = new AliMUONSt1Response(2);
- responseCh2->SetSqrtKx3AndDeriveKx2Kx4(0.7000); // sqrt(0.4900)
- responseCh2->SetSqrtKy3AndDeriveKy2Ky4(0.7550); // sqrt(0.5700)
- responseCh2->SetPitch(0.20); // anode-cathode distance
- responseCh2->SetSigmaIntegration(10.);
- // Mathieson parameters from L.Kharmandarian's thesis, page 190
- responseCh2->SetChargeSlope(62.5); //(62.5);
- // ChargeSlope larger to compensate for the smaller anode-cathode distance
- // and keep the same most probable ADC channel for mip's
- responseCh2->SetChargeSpread(0.144, 0.144);
- responseCh2->SetMaxAdc(4095);
- // assumed proportionality to anode-cathode distance for ChargeSpread
- responseCh2->SetZeroSuppression(3);
- responseChamber2 = responseCh2;
- }
- else {
- // Default response: 4 mm of gas
- AliMUONResponseV0* response0 = new AliMUONResponseV0;
- response0->SetSqrtKx3AndDeriveKx2Kx4(0.7131); // sqrt(0.5085)
- response0->SetSqrtKy3AndDeriveKy2Ky4(0.7642); // sqrt(0.5840)
- response0->SetPitch(0.2); // anode-cathode distance
- response0->SetSigmaIntegration(10.);
- response0->SetChargeSlope(62.5);
- response0->SetChargeSpread(0.144, 0.144);
- response0->SetMaxAdc(4095);
- response0->SetZeroSuppression(0);
-
- responseChamber1 = response0;
- responseChamber2 = response0;
- }
-
- // Segmentation
- //
- AliSegmentation* segmentation11;
- AliSegmentation* segmentation12;
- AliSegmentation* segmentation21;
- AliSegmentation* segmentation22;
-
- if (segmentationVersion == 2) {
- AliMUONSt1Segmentation* seg11 = new AliMUONSt1Segmentation(kBendingPlane);
- seg11->SetDAnod(0.20); // smaller distance between anod
- segmentation11 = seg11;
-
- AliMUONSt1Segmentation* seg12 = new AliMUONSt1Segmentation(kNonBendingPlane);
- seg12->SetDAnod(0.20); // smaller distance between anod
- segmentation12 = seg12;
-
- AliMUONSt1Segmentation* seg21 = new AliMUONSt1Segmentation(kBendingPlane);
- seg21->SetDAnod(0.20); // smaller distance between anod
- segmentation21 = seg21;
-
- AliMUONSt1Segmentation* seg22 = new AliMUONSt1Segmentation(kNonBendingPlane);
- seg22->SetDAnod(0.20); // smaller distance between anod
- segmentation22 = seg22;
- }
- else {
- Float_t rseg1[4]={17.5, 55.2, 71.3, 95.5};
- Int_t nseg1[4]={4, 4, 2, 1};
-
- AliMUONSegmentationV01* seg11=new AliMUONSegmentationV01(4);
- seg11->SetSegRadii(rseg1);
- seg11->SetPadSize(0.42, 0.63); // smaller pad size .....modif Marion 3/12/2
- seg11->SetDAnod(0.20); // smaller distance between anode wires
- seg11->SetPadDivision(nseg1);
- segmentation11 = seg11;
-
- AliMUONSegmentationV02* seg12=new AliMUONSegmentationV02(4);
- seg12->SetSegRadii(rseg1);
- seg12->SetPadSize(0.42, 0.63); // smaller pad size.....modif Marion 3/12/2
- seg12->SetDAnod(0.20); // smaller distance between anode wires
- seg12->SetPadDivision(nseg1);
- segmentation12 = seg12;
-
- AliMUONSegmentationV01* seg21=new AliMUONSegmentationV01(4);
- seg21->SetSegRadii(rseg1);
- seg21->SetPadSize(2.4, 0.4); // smaller pad size
- seg21->SetDAnod(0.20); // smaller distance between anode wires
- seg21->SetPadDivision(nseg1);
- segmentation21 = seg21;
-
- AliMUONSegmentationV02* seg22=new AliMUONSegmentationV02(4);
- seg22->SetSegRadii(rseg1);
- seg22->SetPadSize(0.6, 1.6); // smaller pad size
- seg22->SetDAnod(0.20); // smaller distance between anode wires
- seg22->SetPadDivision(nseg1);
- segmentation22 = seg22;
- }
-
- // Configure station 1
- //
- Int_t chamber=1;
- MUON->SetNsec(chamber-1,2);
- MUON->SetSegmentationModel(chamber-1, 1, segmentation11);
- MUON->SetSegmentationModel(chamber-1, 2, segmentation12);
- MUON->SetResponseModel(chamber-1, responseChamber1);
- MUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
-
- chamber=2;
- MUON->SetNsec(chamber-1,2);
- MUON->SetSegmentationModel(chamber-1, 1, segmentation21);
- MUON->SetSegmentationModel(chamber-1, 2, segmentation22);
- MUON->SetResponseModel(chamber-1, responseChamber2);
- MUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
-
- //--------------------------------------------------------
- // Other stations 2, 3, 4, 5, 6 (Trigger) - default setting
- //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- AliMUONFactory factory;
- for (Int_t i=2; i<7; i++) factory.BuildStation(MUON, i);
-
- // Was: response0->SetMaxAdc(4095);
- // In AliMUONFactory is: fResponse0->SetMaxAdc(4096);
-
- // Station2:
- // Was: Float_t rseg2[4]={23.5, 47.1, 87.7, 122.5};
- // In In AliMUONFactory: Float_t rseg2[4]={23.5, 53.5, 90.5, 122.5};
-
- // in macros: SHILv2
- // in Config_slat: SHILvF
-}
-}
#pragma link C++ class AliMUONSDigitizerV2+;
#pragma link C++ class AliMUONTriggerDecision+;
#pragma link C++ class AliMUONTriggerDecisionV1+;
-
-
#pragma link C++ class AliMUONTest+;
// response
-#pragma link C++ class AliMUONSt1Response+;
-#pragma link C++ class AliMUONSt1ElectronicElement+;
-#pragma link C++ class AliMUONSt1SpecialMotif+;
-#pragma link C++ class AliMUONSt1ResponseParameter+;
-#pragma link C++ class AliMUONSt1ResponseRule+;
-#pragma link C++ class AliMUONSt1IniReader+;
-#pragma link C++ namespace decoder;
#pragma link C++ class AliMUONResponse+;
#pragma link C++ class AliMUONResponseV0+;
#pragma link C++ class AliMUONResponseTrigger+;
# $Id$
SRCS:= AliMUONResponseFactory.cxx \
- AliMUONSt1Response.cxx \
- AliMUONSt1ElectronicElement.cxx \
- AliMUONSt1SpecialMotif.cxx \
- AliMUONSt1ResponseParameter.cxx \
- AliMUONSt1ResponseRule.cxx \
- AliMUONSt1IniReader.cxx \
- AliMUONSt1Decoder.cxx \
AliMUONHitMapA1.cxx \
AliMUONDigitizer.cxx \
AliMUONDigitizerv2.cxx \