30 return id.isBarrel() ?
31 operator()(dynamic_cast<const PixelBarrelName & >(
id)) :
32 operator()(dynamic_cast<const PixelEndcapName & >(
id)) ;
37 for (BarrelConnections::const_iterator
38 ibc = theBarrel.begin(); ibc != theBarrel.end(); ibc++) {
39 for (vector<Bdu>::const_iterator
40 ibd = (*ibc).second.begin(); ibd != (*ibc).second.end(); ibd++) {
41 if ( ibd->b ==
id.shell()
42 && ibd->l.inside(
id.layerName() )
44 && ibd->f.inside(
id.ladderName() ) )
return (*ibc).first;
47 edm::LogError(
"** PixelToFEDAssociateFromAscii WARNING, name: ")
48 <<
id.name()<<
" not associated to FED";
54 for (EndcapConnections::const_iterator
55 iec = theEndcap.begin(); iec != theEndcap.end(); iec++) {
56 for (vector<Edu>::const_iterator
57 ied = (*iec).second.begin(); ied != (*iec).second.end(); ied++) {
58 if ( ied->e ==
id.halfCylinder()
59 && ied->d.inside(
id.diskName() )
60 && ied->b.inside(
id.bladeName() ) )
return iec->first;
63 edm::LogError(
"** PixelToFEDAssociateFromAscii WARNING, name: ")
64 <<
id.name()<<
" not associated to FED";
71 LogDebug(
"init, input file:") << cfg_name.c_str();
73 std::ifstream
file( cfg_name.c_str() );
76 <<
" cant open data file: " << cfg_name;
79 edm::LogInfo(
"PixelToFEDAssociateFromAscii, read data from: ") <<cfg_name ;
83 pair< int, vector<Bdu> > barCon;
84 pair< int, vector<Edu> > endCon;
87 while (getline(
file,line)) {
92 if (pos != string::npos) line = line.erase(pos);
103 if ( line.compare(0,3,
"VER") == 0 ) {
114 else if ( posF != string::npos) {
115 line = line.substr(posF+4);
116 int id = atoi(line.c_str());
125 else if ( posB != string::npos) {
126 line = line.substr(posB+2);
127 barCon.second.push_back( getBdu(line) );
133 else if ( posE != string::npos) {
134 line = line.substr(posE+2);
135 endCon.second.push_back( getEdu(line) );
141 edm::LogError(
"**PixelToFEDAssociateFromAscii** exception")<<err.what();
149 std::ostringstream str;
150 str <<
" **PixelToFEDAssociateFromAscii ** BARREL FED CONNECTIONS: "<< endl;
151 for (BarrelConnections::const_iterator
152 ibc = theBarrel.begin(); ibc != theBarrel.end(); ibc++) {
153 str <<
"FED: " << ibc->first << endl;
154 for (vector<Bdu>::const_iterator
155 ibd = (*ibc).second.begin(); ibd != (*ibc).second.end(); ibd++) {
156 str <<
"b: "<<ibd->b<<
" l: "<<ibd->l<<
" z: "<<ibd->z<<
" f: "<<ibd->f<<endl;
159 str <<
" **PixelToFEDAssociateFromAscii ** ENDCAP FED CONNECTIONS: " << endl;
160 for (EndcapConnections::const_iterator
161 iec = theEndcap.begin(); iec != theEndcap.end(); iec++) {
162 str <<
"FED: " << iec->first << endl;
163 for (vector<Edu>::const_iterator
164 ied = (*iec).second.begin(); ied != (*iec).second.end(); ied++) {
165 str <<
" e: "<<ied->e<<
" d: "<<ied->d<<
" b: "<<ied->b<<endl;
168 edm::LogInfo(
"PixelToFEDAssociateFromAscii")<<str.str();
172 pair<
int,vector<Bdu> > &
b, pair<
int,vector<Edu> > &
e)
const
174 if (
b.second.size() > 0) theBarrel.push_back(
b);
175 if (
e.second.size() > 0) theEndcap.push_back(
e);
185 result.
b = readRange(line).first;
187 pos = line.find(
"L:");
188 if (pos != string::npos) line = line.substr(pos+2);
189 result.
l = readRange(line);
191 pos = line.find(
"Z:");
192 if (pos != string::npos) line = line.substr(pos+2);
193 result.
z = readRange(line);
195 pos = line.find(
"F:");
196 if (pos != string::npos) line = line.substr(pos+2);
197 result.
f = readRange(line);
207 result.
e = readRange(line).first;
209 pos = line.find(
"D:");
210 if (pos != string::npos) line = line.substr(pos+2);
211 result.
d = readRange(line);
213 pos = line.find(
"B:");
214 if (pos != string::npos) line = line.substr(pos+2);
215 result.
b = readRange(line);
226 const char *
line = l.c_str();
229 int num = strtol(line, &evp, 10);
230 { stringstream
s; s<<
"raad from line: "; s<<
num;
LogDebug(s.str()); }
233 if (first) { num1 =
num; first =
false; }
238 string s =
"** PixelToFEDAssociateFromAscii, read data, cant intrpret: " ;
241 <<
"=====> send exception " << endl;
245 return Range(num1,num2);
static BarrelConnections theBarrel
Range readRange(const std::string &) const
static EndcapConnections theEndcap
PixelToFEDAssociateFromAscii(const std::string &fileName)
std::string moduleName(Provenance const &provenance)
void send(std::pair< int, std::vector< Bdu > > &, std::pair< int, std::vector< Edu > > &) const
initialisation (read input file)
void init(const std::string &fileName)
initialisatin (read file)
Bdu getBdu(std::string) const
std::vector< std::pair< int, std::vector< Edu > > > EndcapConnections
PixelRecoRange< float > Range
virtual std::string version() const
version
Edu getEdu(std::string) const
virtual int operator()(const PixelModuleName &) const
FED id for module.
std::vector< std::pair< int, std::vector< Bdu > > > BarrelConnections