24 return id.isBarrel() ?
25 operator()(dynamic_cast<const PixelBarrelName & >(
id)) :
26 operator()(dynamic_cast<const PixelEndcapName & >(
id)) ;
31 for (BarrelConnections::const_iterator
32 ibc = theBarrel.begin(); ibc != theBarrel.end(); ibc++) {
33 for (vector<Bdu>::const_iterator
34 ibd = (*ibc).second.begin(); ibd != (*ibc).second.end(); ibd++) {
35 if ( ibd->b ==
id.shell()
36 && ibd->l.inside(
id.layerName() )
38 && ibd->f.inside(
id.ladderName() ) )
return (*ibc).first;
41 edm::LogError(
"** PixelToFEDAssociateFromAscii WARNING, name: ")
42 <<
id.name()<<
" not associated to FED";
48 for (EndcapConnections::const_iterator
49 iec = theEndcap.begin(); iec != theEndcap.end(); iec++) {
50 for (vector<Edu>::const_iterator
51 ied = (*iec).second.begin(); ied != (*iec).second.end(); ied++) {
52 if ( ied->e ==
id.halfCylinder()
53 && ied->d.inside(
id.diskName() )
54 && ied->b.inside(
id.bladeName() ) )
return iec->first;
57 edm::LogError(
"** PixelToFEDAssociateFromAscii WARNING, name: ")
58 <<
id.name()<<
" not associated to FED";
65 LogDebug(
"init, input file:") << cfg_name.c_str();
67 std::ifstream
file( cfg_name.c_str() );
70 <<
" cant open data file: " << cfg_name;
73 edm::LogInfo(
"PixelToFEDAssociateFromAscii, read data from: ") <<cfg_name ;
77 pair< int, vector<Bdu> > barCon;
78 pair< int, vector<Edu> > endCon;
81 while (getline(
file,line)) {
86 if (pos != string::npos) line = line.erase(pos);
97 if ( line.compare(0,3,
"VER") == 0 ) {
108 else if ( posF != string::npos) {
109 line = line.substr(posF+4);
110 int id = atoi(line.c_str());
119 else if ( posB != string::npos) {
120 line = line.substr(posB+2);
121 barCon.second.push_back( getBdu(line) );
127 else if ( posE != string::npos) {
128 line = line.substr(posE+2);
129 endCon.second.push_back( getEdu(line) );
135 edm::LogError(
"**PixelToFEDAssociateFromAscii** exception")<<err.what();
143 std::ostringstream str;
144 str <<
" **PixelToFEDAssociateFromAscii ** BARREL FED CONNECTIONS: "<< endl;
145 for (BarrelConnections::const_iterator
146 ibc = theBarrel.begin(); ibc != theBarrel.end(); ibc++) {
147 str <<
"FED: " << ibc->first << endl;
148 for (vector<Bdu>::const_iterator
149 ibd = (*ibc).second.begin(); ibd != (*ibc).second.end(); ibd++) {
150 str <<
"b: "<<ibd->b<<
" l: "<<ibd->l<<
" z: "<<ibd->z<<
" f: "<<ibd->f<<endl;
153 str <<
" **PixelToFEDAssociateFromAscii ** ENDCAP FED CONNECTIONS: " << endl;
154 for (EndcapConnections::const_iterator
155 iec = theEndcap.begin(); iec != theEndcap.end(); iec++) {
156 str <<
"FED: " << iec->first << endl;
157 for (vector<Edu>::const_iterator
158 ied = (*iec).second.begin(); ied != (*iec).second.end(); ied++) {
159 str <<
" e: "<<ied->e<<
" d: "<<ied->d<<
" b: "<<ied->b<<endl;
162 edm::LogInfo(
"PixelToFEDAssociateFromAscii")<<str.str();
166 pair<
int,vector<Bdu> > &
b, pair<
int,vector<Edu> > &
e)
168 if (
b.second.size() > 0) theBarrel.push_back(
b);
169 if (
e.second.size() > 0) theEndcap.push_back(
e);
179 result.
b = readRange(line).first;
181 pos = line.find(
"L:");
182 if (pos != string::npos) line = line.substr(pos+2);
183 result.
l = readRange(line);
185 pos = line.find(
"Z:");
186 if (pos != string::npos) line = line.substr(pos+2);
187 result.
z = readRange(line);
189 pos = line.find(
"F:");
190 if (pos != string::npos) line = line.substr(pos+2);
191 result.
f = readRange(line);
201 result.
e = readRange(line).first;
203 pos = line.find(
"D:");
204 if (pos != string::npos) line = line.substr(pos+2);
205 result.
d = readRange(line);
207 pos = line.find(
"B:");
208 if (pos != string::npos) line = line.substr(pos+2);
209 result.
b = readRange(line);
220 const char *
line = l.c_str();
223 int num = strtol(line, &evp, 10);
224 { stringstream
s; s<<
"raad from line: "; s<<
num;
LogDebug(s.str()); }
227 if (first) { num1 =
num; first =
false; }
232 string s =
"** PixelToFEDAssociateFromAscii, read data, cant intrpret: " ;
235 <<
"=====> send exception " << endl;
239 return Range(num1,num2);
PixelRecoRange< float > Range
Range readRange(const std::string &) const
PixelToFEDAssociateFromAscii(const std::string &fileName)
std::string moduleName(Provenance const &provenance)
void init(const std::string &fileName)
initialisatin (read file)
Bdu getBdu(std::string) const
void send(std::pair< int, std::vector< Bdu > > &, std::pair< int, std::vector< Edu > > &)
initialisation (read input file)
Edu getEdu(std::string) const
virtual int operator()(const PixelModuleName &) const override
FED id for module.
virtual std::string version() const override
version